public async Task <IActionResult> PutTwilioSmsModel([FromRoute] string id, [FromBody] TwilioSmsModel twilioSmsModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != twilioSmsModel.SmsSid) { return(BadRequest()); } _context.Entry(twilioSmsModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TwilioSmsModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTwilioSmsModel([FromBody] TwilioSmsModel twilioSmsModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TwilioSmsModels.Add(twilioSmsModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTwilioSmsModel", new { id = twilioSmsModel.SmsSid }, twilioSmsModel)); }
Post([FromForm] TwilioSmsModel twilioSmsModel) { //var twilioSmsModel = new TwilioSmsModel(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TwilioSmsModels.Add(twilioSmsModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTwilioSmsModel", new { id = twilioSmsModel.SmsSid }, twilioSmsModel)); }