public async Task <IActionResult> ChatMasterUpdate([FromBody] ChatMaster chatMaster) { try { chatMaster.ModifiedBy = "Admin"; chatMaster.ModifiedDate = DateTime.Now; db.Entry(chatMaster).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(Ok(chatMaster)); } catch (Exception ex) { return(BadRequest()); } }
public async Task <IActionResult> ChatMasterCreate([FromBody] ChatMaster chatMaster) { try { //chatMaster.EnquiryID = 0; chatMaster.ReplyMessage = null; chatMaster.CraatedBy = "Admin"; chatMaster.CreatedDate = DateTime.Now; chatMaster.ModifiedBy = "Admin"; chatMaster.ModifiedDate = DateTime.Now; chatMaster.Active = true; db.chatMasters.Add(chatMaster); db.SaveChanges(); return(Ok(chatMaster)); } catch (Exception ex) { return(BadRequest()); } }