public async Task <ActionResponse <StudentFileDto> > RemoveFileFromStudent(StudentFileDto entity) { try { unitOfWork.GetGenericRepository <StudentFiles>().Delete(entity.Id.Value); unitOfWork.Save(); return(await ActionResponse <StudentFileDto> .ReturnSuccess(null, "Student upsješno izbrisan iz grupe.")); } catch (Exception) { return(await ActionResponse <StudentFileDto> .ReturnError("Greška prilikom micanja studenta iz grupe.")); } }
public async Task <ActionResponse <StudentFileDto> > AddFileToStudent(StudentFileDto file) { try { var entityToAdd = mapper.Map <StudentFileDto, StudentFiles>(file); unitOfWork.GetGenericRepository <StudentFiles>().Add(entityToAdd); unitOfWork.Save(); file.Id = entityToAdd.Id; return(await ActionResponse <StudentFileDto> .ReturnSuccess(file, "Datoteka uspješno dodana studentu.")); } catch (Exception) { return(await ActionResponse <StudentFileDto> .ReturnError("Greška prilikom dodavanja datoteke studentu.")); } }