public virtual JsonResult FormSubmited(AddUserModel model)
        {
            var response = new ActionResponse <bool>();

            if (model.RoleId <= 0)
            {
                response.Message = LocalMessage.InvalidSelectedRole;
                return(Json(response, JsonRequestBehavior.AllowGet));
            }

            if (!MobileNumberExtension.IsValidMobileNumber(model.MobileNumber))
            {
                response.Message = LocalMessage.InvalidMobileNumber;
                return(Json(response, JsonRequestBehavior.AllowGet));
            }

            if (model.Password != model.RepeatePassword)
            {
                response.Message = LocalMessage.ThePasswordDoesNotMatchIt;
                return(Json(response, JsonRequestBehavior.AllowGet));
            }

            if (model.IsNull() || !ModelState.IsValid)
            {
                response.Message = LocalMessage.InvalidFormData;
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            return(Json(_userBusiness.Insert(model), JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public virtual JsonResult FindUser(int roleId, long mobileNumber)
        {
            if (roleId <= 0)
            {
                return(Json(new ActionResponse <string> {
                    Message = LocalMessage.InvalidSelectedRole
                }, JsonRequestBehavior.AllowGet));
            }

            if (!MobileNumberExtension.IsValidMobileNumber(mobileNumber))
            {
                return(Json(new ActionResponse <string> {
                    Message = LocalMessage.InvalidMobileNumber
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(_userInRoleBusiness.GetUserInRoleChecked(roleId, mobileNumber), JsonRequestBehavior.AllowGet));
        }