public IActionResult DeleteEducation([FromQuery] int eduId) { var lang = Request.Headers["language"].ToString(); var errorMessages = new List <string>(); try { var edu = _educationRepository.FindById(eduId); if (edu == null) { return(NotFound()); } var deletedEducation = _educationRepository.Delete(eduId); return(Ok(new { deletedEducationId = deletedEducation.Id })); } catch { errorMessages.Add(_translator.GetTranslation("ERROR", lang)); return(BadRequest(new { errors = errorMessages })); } }
public OutputBase DeleteEduction(DeleteEducationInput input) { _educationRepository.Delete(input.EducationId); return(new OutputBase { Message = "Education deleted", Success = true }); }
public ActionResult DeleteConfirmed(int id) { Education education = _educationRepository.GetById(id); _educationRepository.Delete(education); _educationRepository.SaveChanges(); return(RedirectToAction("Index")); }
public void Delete(EducationViewModel model) { var item = _repository.FindById(model.Id); if (item != null) { _repository.Delete(item); } }
public async Task <IActionResult> DeleteEducation(int userId, int id) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var workFromRepo = await _repo.GetEducation(id); _repo.Delete(workFromRepo); if (await _repo.SaveAll()) { return(Ok()); } return(BadRequest("Failed to delete")); }
public DataModel.Response.BaseResponse Delete(string id) { try { IEducationRepository educationRepository = RepositoryClassFactory.GetInstance().GetEducationRepository(); educationRepository.Delete(id); return(new BaseResponse { ErrorCode = (int)ErrorCode.None, Message = Resources.Resource.msg_delete_success }); } catch (Exception ex) { return(new BaseResponse { ErrorCode = (int)ErrorCode.Error, Message = ex.Message }); } }
public void Delete(Education model) { _education.Delete(model); }
public IActionResult Delete(int educationId) { educationRepo.Delete(educationId); return(RedirectToAction("Overview")); }
public void Delete(int id) { rep.Delete(id); }
public void Update(UserCreateModel model) { var entity = UserManager.FindById(model.Id); entity.UserName = model.Email; entity.FirstName = model.FirstName; entity.LastName = model.LastName; entity.Email = model.Email; entity.PhoneNumber = model.PhoneNumber; entity.Address = model.Address; entity.Others = model.Others; entity.Website = model.Website; entity.Files = ManageFiles(model); #region Manage Educations foreach (var m in model.Educations.Where(m => string.IsNullOrEmpty(m.UserId))) { m.UserId = model.Id; } foreach (var education in model.Educations) { _educationRepository.InsertOrUpdate(_modelFactory.MapToDomain <EducationModel, Education>(education, null)); } foreach (var m in entity.Educations.Where(y => model.Educations.FirstOrDefault(x => x.Id == y.Id) == null)) { _educationRepository.Delete(m.Id); } _educationRepository.Save(); #endregion #region Manage Experiences foreach (var m in model.Experiences.Where(m => string.IsNullOrEmpty(m.UserId))) { m.UserId = model.Id; } foreach (var m in model.Experiences) { _experienceRepository.InsertOrUpdate(_modelFactory.MapToDomain <ExperienceModel, Experience>(m, null)); } foreach (var m in entity.Experiences.Where(y => model.Experiences.FirstOrDefault(x => x.Id == y.Id) == null)) { _experienceRepository.Delete(m.Id); } _experienceRepository.Save(); #endregion #region Manage Projects foreach (var m in model.Projects.Where(m => string.IsNullOrEmpty(m.UserId))) { m.UserId = model.Id; } foreach (var m in model.Projects) { _projectRepository.InsertOrUpdate(_modelFactory.MapToDomain <ProjectModel, Project>(m, null)); } foreach (var m in entity.Projects.Where(y => model.Projects.FirstOrDefault(x => x.Id == y.Id) == null)) { _projectRepository.Delete(m.Id); } _projectRepository.Save(); #endregion #region Manage Skills foreach (var m in model.Skills.Where(m => string.IsNullOrEmpty(m.UserId))) { m.UserId = model.Id; } foreach (var m in model.Skills) { _skillRepository.InsertOrUpdate(_modelFactory.MapToDomain <SkillModel, Skill>(m, null)); } foreach (var m in entity.Skills.Where(y => model.Skills.FirstOrDefault(x => x.Id == y.Id) == null)) { _skillRepository.Delete(m.Id); } _skillRepository.Save(); #endregion UserManager.Update(entity); }