public async Task <ActionResult <StudentGroupDto> > PostStudentGroup(CreateStudentGroupDto studentGroup) { var isStudentGroupNameExist = await _studentGroupService .IsGroupNameExistAsync(studentGroup.Name); if (isStudentGroupNameExist.Data) { return(Result <StudentGroupDto> .Error(ErrorCode.UnprocessableEntity, "Group name already exists").ToActionResult()); } var resStudentGroup = await _studentGroupService.CreateStudentGroupAsync(studentGroup); return(resStudentGroup.ToActionResult()); }
public async Task <ActionResult <StudentGroupDto> > PostStudentGroup([FromBody] CreateStudentGroupDto studentGroup) { var resStudentGroup = await _studentGroupService.CreateStudentGroupAsync(studentGroup); return(resStudentGroup.ToActionResult()); }