public void Update(LotDto lot) { var orm = _lotRepository.GetById(lot.LotId); orm = lot.ToDal(orm); _lotRepository.Update(orm); }
public LotViewModel CreateLotViewModel(LotDto lotDto) { return(new LotViewModel { Name = lotDto.Name, Price = lotDto.Price, Location = lotDto.Location, Image = lotDto.Image, DateOfUpdate = lotDto.DateOfUpdate, FilterId = lotDto.FilterId, Link = lotDto.Link }); }
public Lot CreateLot(LotDto lotDto) { return(new Lot { FilterId = lotDto.FilterId, Name = lotDto.Name, Price = lotDto.Price, Location = lotDto.Location, Image = lotDto.Image, Link = lotDto.Link, SourceId = lotDto.SourceId, DateOfFound = lotDto.DateOfFound, DateOfUpdate = lotDto.DateOfUpdate, Id = lotDto.Id }); }
public async Task <LotDto> AddLot(LotDto lotData, int shopId) { using (var db = new BuckwheatContext()) { Shop shop = await db.Shops.FirstOrDefaultAsync(x => x.Id == shopId); if (shop == null) { throw new ArgumentException($"Shop with id {shopId} was not found in the database."); } Lot lot = mapper.Map <LotDto, Lot>(lotData); lot.Shop = shop; await db.Lots.AddAsync(lot); await db.SaveChangesAsync(); return(mapper.Map <Lot, LotDto>(lot)); } }
public static Lot ToDal(this LotDto dto, Lot orm) => Mapper.Map(dto, orm);
public static Lot ToDal(this LotDto dto) => Mapper.Map <Lot>(dto);
public LotDto AddItem(LotDto lot) { return(_lotRepository.Create(lot.ToDal()).ToDto()); }
public static LotViewModel ToVm(this LotDto dto) => Mapper.Map <LotViewModel>(dto);