public async Task <IActionResult> PutMstCustomerEnquiry([FromRoute] int id, [FromBody] MstCustomerEnquiry mstCustomerEnquiry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mstCustomerEnquiry.CustomerEnquiryId) { return(BadRequest()); } _context.Entry(mstCustomerEnquiry).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MstCustomerEnquiryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> UpdateCustomerEnquiry(int id, [FromBody] MstCustomerEnquiry mstCustomerEnquiry) { try { if (mstCustomerEnquiry != null && id != 0) { using (EzyFind_DevContext db = new EzyFind_DevContext()) { db.MstCustomerEnquiry.Update(mstCustomerEnquiry); await db.SaveChangesAsync(); id = mstCustomerEnquiry.CustomerEnquiryId; } response.Status = true; // Operation Status Indicator response.Message = "Successful: Customer Enquiry updated"; // Exception Message response.Result = id; return(Ok(response)); } else { response.Status = false; // Operation Status Indicator response.Message = "Warning : No Customer Enquiry provided"; // Exception Message response.Result = null; return(Ok(response)); } } catch { response.Status = false; // Operation Status Indicator response.Message = "Error : Unable to update Customer Enquiry"; // Exception Message response.Result = null; return(Ok(response)); } }
public async Task <IActionResult> PostMstCustomerEnquiry([FromBody] MstCustomerEnquiry mstCustomerEnquiry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MstCustomerEnquiry.Add(mstCustomerEnquiry); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMstCustomerEnquiry", new { id = mstCustomerEnquiry.CustomerEnquiryId }, mstCustomerEnquiry)); }