public JsonResult Create([FromBody] Users user) { try { if (ModelState.IsValid) { //Users userObj = JsonConvert.DeserializeObject<Users>(user); user.Application = "PAYROLL";//ViewBag("Application"); // TODO: Add update logic here _context.Add(user); _context.SaveChanges(); } return(Json(new { Success = true })); } catch { throw; } }
public JsonResult Create(string role) { try { if (ModelState.IsValid) { Roles roleObj = JsonConvert.DeserializeObject <Roles>(role); roleObj.Application = "Payroll";//ViewBag("Application"); // TODO: Add update logic here //_context.Update(user); _context.Add(roleObj); _context.SaveChanges(); } return(Json(new { Success = true })); } catch (Exception) { throw; } }