public ResponseResult AddUserPermission(USER_PERMISSION permission) { try { _db.Entry(permission).State = EntityState.Modified; _db.SaveChanges(); return new ResponseResult(); } catch (Exception ex) { //return new ResponseResult(); return new ResponseResult(ResutlType.Error, ex.Message); } } [HttpPost] [CustomAuthorize("Admin")] public ActionResult Create(USER model) { try { string moduleId = Request.Form["ModuleId"]; string isSelected = Request.Form["IsSelected"]; model.DATE_CREATED = DateTime.Now; model.DATE_UPDATED = DateTime.Now; model.STATUS = (int)Status.Active; var userPermission = processPermissionData(moduleId, isSelected); //userPermission contains a list of permissions which i am trying to save _userService.Add(model); foreach (var permission in userPermission) { _userService.AddUserPermission(permission); } return RedirectToAction("Index"); } catch { return View(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)