예제 #1
0
        public async Task <bool> UpdateProfile(VMProfile profile)
        {
            try
            {
                var resultExist = await _iaccountdata.GetById(profile.Id);

                if (resultExist == null)
                {
                    throw new Exception("Not Exist");
                }

                resultExist.Name           = profile.Name;
                resultExist.Surname        = profile.Surname;
                resultExist.NumberDocument = profile.NumberDocument;
                resultExist.IdRol          = profile.IdRol;
                resultExist.IdTypeDocument = profile.IdTypeDocument;

                var result = await _iaccountdata.EditAsync(resultExist);


                return(result);
            }

            catch (Exception)
            {
                return(false);
            }
        }
 public IActionResult OnGet(string userId)
 {
     userProfile = accountData.GetById(userId);
     if (userProfile == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
예제 #3
0
 public IActionResult OnGet(int blogId)
 {
     Blog = blogData.GetById(blogId);
     if (Blog == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     userProfile = accountData.GetById(Blog.userId);
     return(Page());
 }
예제 #4
0
 public IActionResult OnGet(string userId)
 {
     userProfile = accountData.GetById(userId);
     if (userProfile == null)
     {
         return RedirectToPage("./NotFound");
     }
     Input = new InputModel
     {
         userId = userProfile.Id,
         firstName = userProfile.firstName,
         lastName = userProfile.lastName
     };
     return Page();
 }
예제 #5
0
        public async Task <IActionResult> OnPost(int expertId)
        {
            Expert = expertData.GetById(expertId);
            if (Expert == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            userProfile          = accountData.GetById(Expert.userId);
            userProfile.IsExpert = false;
            accountData.Update(userProfile);

            foreach (var answer in Expert.Answers)
            {
                answerData.Delete(answer);
            }

            await answerData.Commit();

            expertData.Delete(Expert);

            if (await expertData.Commit())
            {
                if (await accountData.Commit())
                {
                    TempData["Message"] = $"Expert {Expert.firstName} {Expert.lastName} Deleted";
                    return(RedirectToPage("./ManageExperts"));
                }
            }
            return(RedirectToPage("./NotFound"));
        }
        public IActionResult OnGet(int questionId)
        {
            Question = questionData.GetById(questionId);

            if (Question == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            userProfile = accountData.GetById(Question.userId);
            return(Page());
        }
예제 #7
0
        public async Task <IActionResult> OnGet(int questionId)
        {
            Question = questionData.GetById(questionId);
            if (Question == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            var user = await userManager.GetUserAsync(User);

            userId      = user.Id;
            userProfile = accountData.GetById(Question.userId);
            return(Page());
        }