public void CloseTender(TenderDto tenderDto) { var tender = _databaseContext.Tenders.Find(tenderDto.TenderId); tender.isClosed = true; _databaseContext.SaveChanges(); EvaluationTenderBids(tender.TenderId); }
public IActionResult CaptureNewTender([FromBody] TenderDto tenderDto) { if (tenderDto == null) { return(BadRequest("Invalid model")); } var result = _tenderService.AddNewTender(tenderDto); return(Ok(result)); }
public void EditTender(TenderDto tenderBid) { var tender = _databaseContext.Tenders.Find(tenderBid.TenderId); tender.Description = tenderBid.Description; tender.OpenDate = tenderBid.OpenDate; tender.CloseDate = tenderBid.CloseDate; tender.ContactNo = tenderBid.ContactNo; tender.EmailAddress = tenderBid.EmailAddress; tender.StateOrganId = tenderBid.StateOrganId; _databaseContext.SaveChanges(); }
public Tender AddNewTender(TenderDto tenderDto) { var tender = new Tender { Description = tenderDto.Description, OpenDate = tenderDto.OpenDate, CloseDate = tenderDto.CloseDate, ContactNo = tenderDto.ContactNo, EmailAddress = tenderDto.EmailAddress, StateOrganId = tenderDto.StateOrganId }; _databaseContext.Tenders.Add(tender); _databaseContext.SaveChanges(); return(tender); }
public async Task <TenderDto> GetTenderById(long tenderId) { var currentUser = await _userService.GetCurrentUserAsync(); var tender = await GetFullQuery() .SingleOrDefaultAsync(t => t.Id == tenderId); if (tender == null) { throw new NotFoundException("тендер с таким ID не найден"); } var dto = new TenderDto(); _mapper.Map(tender, dto, opt => opt.AfterMap((s, d) => { d.Favorite = s.Favorites.Any(f => f.UserId == currentUser.Id); })); return(dto); }
public void Put([FromBody] TenderDto tenderDto) { _tenderService.CloseTender(tenderDto); }