public IActionResult Create(Employee emp) { try { Action act; if (emp.Id == 0) { act = Action.Add; } else { act = Action.Update; } context.AddUpdateEmployee(emp); if (act == Action.Update) { TempData["message"] = "Employee Update Success..."; } else { TempData["message"] = "Employee Added Success..."; } return(RedirectToAction("Index")); } catch (Exception ex) { throw; } }