public async Task <IActionResult> EditSubject(string Code, EditSubjectDto editSubjectDto) { if (editSubjectDto == null) { return(BadRequest(resourceManager.GetString("Null"))); } var edit_subject = await subjectService.EditSubject(Int32.Parse(Code), editSubjectDto); if (edit_subject == null) { return(NotFound(resourceManager.GetString("Id"))); } return(Ok()); }
public async Task <EditSubjectDto> EditSubject(int id, EditSubjectDto editSubjectDto) { if (editSubjectDto == null) { return(null); } var subject = await subjectRepository.GetSubjectById(id); if (subject == null) { return(null); } subject.Name = editSubjectDto.Name; subjectRepository.Update(subject); await subjectRepository.SaveChangesAsync(); return(mapper.Map <EditSubjectDto>(subject)); }