public static EducationCreateDto ToDto(this EducationCreateViewModel source) { return(new EducationCreateDto { Image = source.Image, Title = source.Title }); }
public IActionResult Post(EducationCreateViewModel model) { if (this.ModelState.IsValid) { Education education = model.ToEducationEntity(); var repo = this.Storage.GetRepository <IEducationRepository>(); repo.Create(education, GetCurrentUserName()); this.Storage.Save(); return(Ok(new { success = true, data = education })); } return(BadRequest(new { success = false })); }
public IActionResult Create(EducationCreateViewModel model) { var serviceResult = _adminService.CreateEducation(model.ToDto()); return(View_Post(serviceResult, model)); }