Exemplo n.º 1
0
        public Offer Insert(OfferInsertRequest req)
        {
            var entity = _mapper.Map <Database.Offers>(req);

            _context.Offers.Add(entity);
            _context.SaveChanges();
            return(_mapper.Map <Data.Model.Offer>(entity));
        }
Exemplo n.º 2
0
        public Offer Update(int id, OfferInsertRequest req)
        {
            var entity = _context.Offers.Find(id);

            _context.Attach(entity);
            _context.Update(entity);
            entity.isLocked      = true;
            entity.partsSelected = true;
            _context.SaveChanges();
            return(_mapper.Map <Data.Model.Offer>(entity));
        }
Exemplo n.º 3
0
        public async Task SendOffer()
        {
            var request = new OfferInsertRequest
            {
                CreatedAt     = DateTime.Now,
                OfferStatusId = (int)Models.OfferStatus.Active,
                RequestId     = Id,
                UserId        = UserId
            };

            await _offerService.Insert <Offer>(request);
        }
        public async Task ChangeToSelected()
        {
            Data.Model.OfferItems   model;
            OfferItemsInsertRequest req = new OfferItemsInsertRequest()
            {
                OfferID = 0
            };

            foreach (var x in _selectedParts)
            {
                model = await _offerItemsUpdateService.Update <Data.Model.OfferItems>(x.ItemID, req);
            }
            OfferInsertRequest reqs = new OfferInsertRequest();
            await _offerService.Update <Data.Model.Offer>(OfferVM.OfferID, reqs);
        }
Exemplo n.º 5
0
 public Data.Model.Offer Update(int id, OfferInsertRequest req)
 {
     return(_service.Update(id, req));
 }
Exemplo n.º 6
0
 public Data.Model.Offer Insert([FromBody] OfferInsertRequest req)
 {
     return(_service.Insert(req));
 }