public async Task <ActionResponse <DiaryStudentGroupDto> > DeleteDiaryStudentGroup(DiaryStudentGroupDto entityDto) { try { unitOfWork.GetGenericRepository <DiaryStudentGroup>().Delete(entityDto.Id.Value); unitOfWork.Save(); return(await ActionResponse <DiaryStudentGroupDto> .ReturnSuccess(null, "Brisanje grupe studenata iz dnevnika rada uspješno.")); } catch (Exception) { return(await ActionResponse <DiaryStudentGroupDto> .ReturnError("Greška prilikom unošenja grupe studenata za dnevnik rada.")); } }
public async Task <ActionResponse <DiaryStudentGroupDto> > InsertDiaryStudentGroup(DiaryStudentGroupDto entityDto) { try { var entityToAdd = mapper.Map <DiaryStudentGroupDto, DiaryStudentGroup>(entityDto); unitOfWork.GetGenericRepository <DiaryStudentGroup>().Add(entityToAdd); unitOfWork.Save(); mapper.Map(entityToAdd, entityDto); return(await ActionResponse <DiaryStudentGroupDto> .ReturnSuccess(mapper.Map(entityToAdd, entityDto))); } catch (Exception) { return(await ActionResponse <DiaryStudentGroupDto> .ReturnError("Greška prilikom unošenja grupe studenata za dnevnik rada.")); } }