public void Update(Client client)
 {
     if (client != null && client.IsValid())
     {
         PerformCall(() => mUpdateRepository.Update(client));
     }
 }
Пример #2
0
        public ActionResult Login(UserLogin user)
        {
            if (ModelState.IsValid)
            {
                var dbUser = TryAction(() => mReadRepository.GetFirstOfDefault(x => x.Login == user.Login));

                if (dbUser == null)
                {
                    ModelState.AddModelError("", "User not found");
                    return(View(user));
                }

                if (!dbUser.IsBlocked)
                {
                    if (dbUser.Password == user.Password)
                    {
                        FormsAuthentication.SetAuthCookie(dbUser.Name, true);
                        dbUser.CountAttemptsToAccess = 0;
                        PerformCall(() => mUpdateRepository.Update(dbUser));
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        dbUser.CountAttemptsToAccess++;
                        if (dbUser.CountAttemptsToAccess == 5)
                        {
                            ModelState.AddModelError("", "User is blocked");
                            dbUser.IsBlocked = true;
                            PerformCall(() => mUpdateRepository.Update(dbUser));
                            ///TODO: go to inbloked
                        }
                        else
                        {
                            PerformCall(() => mUpdateRepository.Update(dbUser));
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "User is blocked");
                    ///TODO: go to inbloked
                }
            }
            return(View(user));
        }
Пример #3
0
        public async Task <ExperienceReadModel> UpdateExperience(ExperienceWriteModel command)
        {
            var user = await userRepository.GetByName(UserInfo.UserName);

            var userInfo         = candidateRepository.GetById(user.Id);
            var experienceEntity = BuildExperienceModel(command);

            var experience = experienceReadRepository.GetById(command.Id);

            experience.CompanyName = command.CompanyName;
            experience.FromDate    = command.FromDate.Value;
            experience.ToDate      = command.ToDate;
            experience.Position    = command.Position;

            experienceUpdateRepository.Update(experience);
            experienceRepository.Save();

            return(new ExperienceReadModel(experienceEntity));
        }
Пример #4
0
 public void EditUpdate(Update update)
 {
     updateRepository.Update(update);
     SaveUpdate();
 }
Пример #5
0
 public bool Update(T entity)
 {
     return(UpdateRepository.Update(entity));
 }