public ActionResult AddEditPrivilege(List <UserPrivilegeViewModel> model) { foreach (var up in model) { if (up.Id == 0) { _userPrivilege.Create(up); } else { _userPrivilege.Update(up); } } return (Json( new { redirectTo = Url.Action("Index", "UserPrivilege", new { Area = "Admin" }), message = "Record updated Successfully !!!", position = "mainContainer" })); }