public async Task <ActionResult> Create(EducationTypeResource EducationTypeResource) { if (ModelState.IsValid) { var educationType = Mapper.Map <EducationTypeResource, EducationType>(EducationTypeResource); educationType.CreatedDate = DateTime.Now; educationType.UpdatedDate = DateTime.Now; var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); educationType.UserId = userId; await _educationTypeService.AddAsync(educationType); _educationTypeService.UnitOfWorkSaveChanges(); return(RedirectToAction("Index")); } return(View(EducationTypeResource)); }
public async Task <ActionResult> Edit(EducationTypeResource educationTypeResource) { if (ModelState.IsValid) { var exstEducationType = await _educationTypeService.GetByIdAsync(Convert.ToInt32(educationTypeResource.Id)); exstEducationType.Name = educationTypeResource.Name; exstEducationType.Status = educationTypeResource.Status; exstEducationType.UpdatedDate = DateTime.Now; var userId = System.Web.HttpContext.Current.User.Identity.GetUserId(); exstEducationType.UserId = userId; await _educationTypeService.UpdateAsync(exstEducationType); _educationTypeService.UnitOfWorkSaveChanges(); return(RedirectToAction("Index")); } return(View(educationTypeResource)); }