예제 #1
0
        public ActionResult RequestForApproving()
        {
            Int64 userId      = Convert.ToInt64(TempData["UserId"]);
            var   userDetails = _user.FindBy(x => x.UserId == userId).FirstOrDefault();

            return(View(userDetails));
        }
예제 #2
0
 public ActionResult ChangePassword(ChangePassWord model)
 {
     if (ModelState.IsValid)
     {
         //var user = _user.GetUser(UserAuthenticate.UserId);
         var user = _user.FindBy(x => x.UserId == UserAuthenticate.UserId).FirstOrDefault();
         if (user != null)
         {
             if (user.Password == model.OldPassword)
             {
                 user.Password = model.NewPassword;
                 bool Success = _user.Update(user);
                 ViewBag.Message = Success ? "Password has been changed." : "The Login Id Or Password You enterd Is Invalid";
             }
             else
             {
                 ModelState.AddModelError("OldPassword", "Please enter correct current password.");
             }
         }
     }
     return(View(model));
 }
예제 #3
0
        public HttpResponseMessage CreateUser(UsermasterModel usermasterModel)
        {
            ResponseWithData <Usermaster> _response = new ResponseWithData <Usermaster>();
            var _getUser = _userMaster.FindBy(x => x.Phone == usermasterModel.Phone.Trim() || x.Email.Trim().ToLower() == usermasterModel.Email.Trim().ToLower()).FirstOrDefault();

            if (_getUser != null)
            {
                _response.Type    = "error";
                _response.Message = "User already Exist";
                _response.data    = null;
                return(Request.CreateResponse(HttpStatusCode.OK, _response));
            }

            var model = Mapper.Map <UsermasterModel, Usermaster>(usermasterModel);

            string[] arrName = model.Email.Split('@');
            model.UserName  = model.Email.Trim();
            model.Password  = arrName[0] + "@123";
            model.Status    = 0;
            model.IsDeleted = false;
            var response = _userMaster.CreateUser(model);

            if (response != null)
            {
                _response.Type    = "success";
                _response.Message = "success";
                _response.data    = response;
                return(Request.CreateResponse(HttpStatusCode.OK, _response));
            }
            else
            {
                _response.Type    = "error";
                _response.Message = "error";
                _response.data    = null;
                return(Request.CreateResponse(HttpStatusCode.OK, _response));
            }
        }
예제 #4
0
 public IQueryable <UserMaster> FindBy(Expression <Func <UserMaster, bool> > predicate)
 {
     return(userMasterRepository.FindBy(predicate));
 }