public JsonResult Save([Bind(Include = "RoleID,OperationID,HaveAccess,SetOn,SetBy")] RoleWiseOperationPermission rolewiseoperationpermission, bool isInsert)
        {
            if (ModelState.IsValid)
            {
                rolewiseoperationpermission.SetBy = LoginInformation.UserID;
                rolewiseoperationpermission.SetOn = DateTime.Now;

                if (isInsert)
                {
                    _unitOfWork.RolewiseOperationPermissionRepository.Insert(rolewiseoperationpermission);
                }
                else
                {
                    _unitOfWork.RolewiseOperationPermissionRepository.UpdateRoleWiseOperationPermission(rolewiseoperationpermission);
                }
                _unitOfWork.Save();
            }

            ViewBag.RoleID      = new SelectList(_unitOfWork.RoleRepository.Get(), "RoleID", "RoleName", rolewiseoperationpermission.RoleID);
            ViewBag.OperationID = new SelectList(_unitOfWork.ScreenOperationRepository.Get(), "OperationID", "OperationTitle", rolewiseoperationpermission.OperationID);

            return(new JsonResult {
                Data = _unitOfWork.RolewiseOperationPermissionRepository.GetByValue(rolewiseoperationpermission.RoleID, rolewiseoperationpermission.OperationID).FirstOrDefault()
            });
        }
Exemplo n.º 2
0
 public static RolePermissionView ToRoleOperationPermissionView(this RoleWiseOperationPermission roleOperationPermission)
 {
     return(new RolePermissionView
     {
         RoleID = roleOperationPermission.RoleID,
         OperationID = roleOperationPermission.OperationID,
         HaveAccess = roleOperationPermission.HaveAccess,
         SetOn = roleOperationPermission.SetOn.ToString("dd-MMM-yyyy"),
         SetBy = roleOperationPermission.SetBy
     });
 }