Esempio n. 1
0
        public async Task <IActionResult> UpdateEducation(UpdateEducationRequestModel model)
        {
            model.UserId = User.Identity.GetUserId();
            var education = await _educationService.UpdateEducationAsync(model);

            if (education != null)
            {
                return(FormResult.CreateSuccessResult("Updated education", Url.Action("UpdateEducation", "Education", new { Id = education.Id })));
            }
            else
            {
                return(FormResult.CreateErrorResult("An error occurred"));
            }
        }
Esempio n. 2
0
        public async Task <EducationResponseModel> UpdateEducationAsync(UpdateEducationRequestModel model)
        {
            var findEducation = await _dbContext.Education.Where(x => x.Id == model.Id && !x.IsDeleted).FirstOrDefaultAsync();

            if (findEducation != null)
            {
                findEducation = model.Adapt(findEducation);
                findEducation.UpdateUserId = model.UserId.Value;

                var resultValue = await _uow.CommitAsync();

                if (resultValue)
                {
                    var resModel = findEducation.Adapt <EducationResponseModel>();
                    return(resModel);
                }
            }


            return(null);
        }