public void Delete(DalLot entity) { var lot = entity.ToLot(); lot = _dbContext.Set <Lot>().Single(l => l.LotId == lot.LotId); _dbContext.Set <Lot>().Remove(lot); }
public void Update(DalLot entity) { var updatedLot = entity.ToLot(); var existedLot = _dbContext.Entry <Lot>(_dbContext.Set <Lot>().Find(updatedLot.LotId)); if (existedLot == null) { return; } existedLot.State = EntityState.Modified; existedLot.Entity.BlockReason = entity.BlockReason; existedLot.Entity.IsBlocked = entity.IsBlocked; existedLot.Entity.IsConfirm = entity.IsConfirm; existedLot.Entity.IsSold = entity.IsSold; existedLot.Entity.CategoryRefId = entity.CategoryRefId; existedLot.Entity.LotName = entity.LotName; existedLot.Entity.Discription = entity.Discription; existedLot.Entity.EndDate = entity.EndDate; }
public void Create(DalLot entity) { var lot = entity.ToLot(); _dbContext.Set <Lot>().Add(lot); }