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 Delete(DalLot e) { var lot = e.ToOrmLot(); lot = _context.Set <Lot>().Single(u => u.Id == lot.Id); _context.Set <Lot>().Remove(lot); }
public void CloseLot(DalLot lot) { var ormlot = _context.Set <Lot>().Single(u => u.Id == lot.Id); ormlot.LotClosed = true; _context.Entry(ormlot).State = EntityState.Modified; }
public void Delete(DalLot entity) { var lot = _context.Set <Lot>().Single(l => l.Id == entity.Id); _context.Set <Bid>().RemoveRange(lot.Bids); _context.Set <Comment>().RemoveRange(lot.Comments); _context.Set <Lot>().Remove(lot); }
public static BllLot ToBllLot(this DalLot lot) { return(new BllLot() { Id = lot.Id, AuctionEndDate = lot.Expired, Categorie = lot.Categorie, CreationDate = lot.DateOfCreation, CurrentPrice = lot.Price, Description = lot.Description, LastUpdateDate = lot.LastUpdated, Photos = lot.Photos, Seller = lot.Seller, Title = lot.Title }); }
public static Lot ToOrmLot(this DalLot lot) { return(new Lot { Id = lot.Id, BuyOutBet = lot.BuyOutBet, CreatedByUserId = lot.CreatedByUserId, EndDate = lot.EndDate, LotClosed = lot.LotClosed, LotEnded = lot.LotEnded, LotDescription = lot.LotDescription, Name = lot.Name, LotPicture = lot.LotPicture, LotPicturePreview = lot.LotPicturePreview, MinimalBet = lot.MinimalBet }); }
public void Update(DalLot e) { var lot = _context.Set <Lot>().Single(u => u.Id == e.Id); lot.Id = e.Id; lot.BuyOutBet = e.BuyOutBet; lot.CreatedByUserId = e.CreatedByUserId; lot.EndDate = e.EndDate; lot.LotClosed = e.LotClosed; lot.LotEnded = e.LotEnded; lot.LotDescription = e.LotDescription; lot.Name = e.Name; lot.LotPicture = e.LotPicture; lot.LotPicturePreview = e.LotPicturePreview; lot.MinimalBet = e.MinimalBet; _context.Entry(lot).State = EntityState.Modified; }
public static LotEntity ToBllLotEntity(this DalLot lot) { return(new LotEntity { BuyOutBet = lot.BuyOutBet, CreatedByUserId = lot.CreatedByUserId, EndDate = lot.EndDate, Id = lot.Id, LotClosed = lot.LotClosed, LotDescription = lot.LotDescription, LotPicture = lot.LotPicture, LotPicturePreview = lot.LotPicturePreview, MinimalBet = lot.MinimalBet, Name = lot.Name, LotEnded = lot.LotEnded, CreatedByUser = lot.CreatedByUser.ToBllUserEntity() }); }
public static Lot ToLot(this DalLot dalLot) { return(new Lot() { LotId = dalLot.Id, IsBlocked = dalLot.IsBlocked, CategoryRefId = dalLot.CategoryRefId, IsConfirm = dalLot.IsConfirm, Discription = dalLot.Discription, BlockReason = dalLot.BlockReason, LotName = dalLot.LotName, SellerRefId = dalLot.SellerRefId, EndDate = dalLot.EndDate, IsSold = dalLot.IsSold, StartDate = dalLot.StartDate, StartingBid = dalLot.StartingBid }); }
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 static DalLot ToDalLot(this LotEntity lotEntity) { DalLot newLot = new DalLot { Id = lotEntity.Id, Name = lotEntity.Name, StartPrice = lotEntity.StartPrice, LastPrice = lotEntity.LastPrice, Description = lotEntity.Description, StartDate = lotEntity.StartDate, Duration = lotEntity.Duration, ImageData = lotEntity.ImageData, ImageType = lotEntity.ImageType, State = lotEntity.State.ToDalLotState(), UserId = lotEntity.UserId, CategoryId = lotEntity.CategoryId }; return(newLot); }
public static Lot ToOrmLot(this DalLot dalLot) { Lot newLot = new Lot { Id = dalLot.Id, Name = dalLot.Name, StartPrice = dalLot.StartPrice, LastPrice = dalLot.LastPrice, Description = dalLot.Description, StartDate = dalLot.StartDate, Duration = dalLot.Duration, ImageData = dalLot.ImageData, ImageType = dalLot.ImageType, State = dalLot.State.ToOrmLotState(), UserId = dalLot.UserId, CategoryId = dalLot.CategoryId }; return(newLot); }
public static LotEntity ToBllLot(this DalLot dalLot) { return(dalLot == null ? null : new LotEntity { Id = dalLot.Id, Name = dalLot.Name, StartPrice = dalLot.StartPrice, LastPrice = dalLot.LastPrice, Description = dalLot.Description, StartDate = dalLot.StartDate, Duration = dalLot.Duration, ImageData = dalLot.ImageData, ImageType = dalLot.ImageType, State = dalLot.State.ToBllLotState(), User = dalLot.User.ToBllUser(), Category = dalLot.Category.ToBllCategory(), UserId = dalLot.UserId, CategoryId = dalLot.CategoryId, Bids = dalLot.Bids.Select(b => b.ToBllBid()), Comments = dalLot.Comments.Select(b => b.ToBllComment()) }); }
public static DalLot ToDalLot(this Lot orm) { if (orm == null) { return(null); } var lot = new DalLot { Id = orm.Id, Name = orm.Name, StartDate = orm.StartDate, EndDate = orm.EndDate, IsActive = orm.IsActive, IsChecked = orm.IsChecked, Picture = orm.Picture, ProfileId = orm.ProfileId, Description = orm.Description, Tags = orm.Tags.Select(tag => new DalTag { Id = tag.Id, Name = tag.Name } ).ToList(), Bids = orm.Bids.Select(bid => new DalBid { Id = bid.Id, Date = bid.Date, LotId = bid.LotId, Price = bid.Price, ProfileId = bid.ProfileId } ).ToList() }; return(lot); }
public static Lot ToOrmLot(this DalLot lot) { if (lot == null) { return(null); } var orm = new Lot { Id = lot.Id, Name = lot.Name, StartDate = lot.StartDate, EndDate = lot.EndDate, IsActive = lot.IsActive, IsChecked = lot.IsChecked, Picture = lot.Picture, ProfileId = lot.ProfileId, Description = lot.Description, Tags = lot.Tags.Select(tag => new Tag { Id = tag.Id, Name = tag.Name } ).ToList(), Bids = lot.Bids.Select(bid => new Bid { Id = bid.Id, Date = bid.Date, LotId = bid.LotId, Price = bid.Price, ProfileId = bid.ProfileId } ).ToList(), }; return(orm); }
public static LotEntity ToBllLot(this DalLot dalLot) { if (dalLot == null) { return(null); } var lot = new LotEntity { Id = dalLot.Id, Name = dalLot.Name, StartDate = dalLot.StartDate, EndDate = dalLot.EndDate, IsActive = dalLot.IsActive, IsChecked = dalLot.IsChecked, Picture = dalLot.Picture, ProfileId = dalLot.ProfileId, Description = dalLot.Description, Tags = dalLot.Tags.Select(tag => new TagEntity { Id = tag.Id, Name = tag.Name } ).ToList(), Bids = dalLot.Bids.Select(bid => new BidEntity { Id = bid.Id, ProfileId = bid.ProfileId, Date = bid.Date, Price = bid.Price, LotId = bid.LotId } ).ToList() }; return(lot); }
public void Create(DalLot entity) { var lot = entity.ToLot(); _dbContext.Set <Lot>().Add(lot); }
public void Update(DalLot entity) { _context.Set <Lot>().AddOrUpdate(entity.ToOrmLot()); }
public void Create(DalLot entity) { _context.Set <Lot>().Add(entity.ToOrmLot()); }