public async Task <ActionResultReponese <string> > InsertAsync(FacultyMeta facultyMeTa) { var isFaculty = await _facultyRepository.CheckExitsFacult(facultyMeTa.NameFaculty); if (isFaculty) { return(new ActionResultReponese <string>(-21, "IdFaculty da ton tai", "Faculty", null)); } var _faculty = new Faculty { IdFaculty = Guid.NewGuid().ToString(), NameFaculty = facultyMeTa?.NameFaculty.Trim(), IsActive = true, IsDelete = false }; var Result = await _facultyRepository.InsertAsync(_faculty); if (Result >= 0) { return(new ActionResultReponese <string>(Result, "thanh cong", "Faculty", null)); } return(new ActionResultReponese <string>(Result, "that bai", "Faculty", null)); }
public async Task <IActionResult> InsertAsync([FromBody] FacultyMeta facultyMeta) { var result = await _faculty.InsertAsync(facultyMeta); return(Ok(result)); }