47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using Kreta.DataAccess.Interfaces;
|
|
using Kreta.DataAccessManual.Interfaces;
|
|
using Kreta.DataAccessManual.Util;
|
|
using Kreta.Framework.Util;
|
|
using SDA.Kreta.Entities;
|
|
|
|
namespace Kreta.DataAccessManual
|
|
{
|
|
internal class FileDal : DataAccessBase, IFileDAL
|
|
{
|
|
public FileDal(DalHandler handler) : base(handler) { }
|
|
public FileDal(DalHandler handler, GridParameters parameters) : base(handler, parameters) { }
|
|
|
|
public IFile Get()
|
|
{
|
|
return File.GiveAnInstance();
|
|
}
|
|
|
|
public IFile Get(int id)
|
|
{
|
|
var entity = File.GiveAnInstance();
|
|
entity.LoadByID(id);
|
|
return entity;
|
|
}
|
|
|
|
public int Insert(IFile dto)
|
|
{
|
|
var entity = dto as File;
|
|
|
|
entity.Insert();
|
|
dto.ID = entity.ID;
|
|
DalHelper.Commit();
|
|
|
|
return dto.ID;
|
|
}
|
|
|
|
public void Delete(int id, int userId)
|
|
{
|
|
var entity = Get(id) as File;
|
|
|
|
entity.Torolt = true;
|
|
|
|
entity.FullUpdate();
|
|
DalHelper.Commit();
|
|
}
|
|
}
|
|
}
|