public async Task <IActionResult> PostRequestForQuote([FromBody] RequestForQuote requestforquote) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.RequestForQuote.Add(requestforquote); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (RequestForQuoteExists(requestforquote.QuoteId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetRequestForQuote", new { id = requestforquote.QuoteId }, requestforquote)); }
public async Task <IActionResult> PutRequestForQuote([FromRoute] int id, [FromBody] RequestForQuote requestforquote) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != requestforquote.QuoteId) { return(BadRequest()); } _context.Entry(requestforquote).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RequestForQuoteExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("QuoteId,ClientName,ClientPhone,ClientEmail,ClientRep,ClientRepContact,ProjectName,ProjectManager,PredStartDate,PredCompletionDate,ProjectDescription")] RequestForQuote requestforquote) { if (ModelState.IsValid) { var result = await _context.PostApiCall <RequestForQuote>("RequestForQuotes", requestforquote); return(RedirectToAction(nameof(Index))); } return(View(requestforquote)); }
public async Task <IActionResult> Edit(int id, [Bind("QuoteId, ClientName, ClientPhone, ClientEmail, ClientRep, ClientRepContact, ProjectName, ProjectManager, PredStartDate, PredCompletionDate, ProjectDescription")] RequestForQuote requestforquote) { if (id != requestforquote.QuoteId) { return(NotFound()); } if (ModelState.IsValid) { var result = await _context.PutApiCall <RequestForQuote>(string.Concat("RequestForQuotes", "/", id), requestforquote); return(RedirectToAction(nameof(Index))); } return(View(requestforquote)); }