public IActionResult DeleteUniversity(long id) { University a = Uni_repo.Find(id); if (a == null) { return(NotFound()); } Uni_repo.Delete(a); return(Ok()); }
public Tuple <bool, string, University> FindUniversity(long universityId) { try { var query = _universityRepository.Find(s => s.Id == universityId); return(new Tuple <bool, string, University>(true, "عملیات با موفیت انجام شد", query)); } catch (Exception) { return(new Tuple <bool, string, University>(true, "عملیات با مشکل مواجه شده است", null)); } }
public Tuple <bool, string> AddOrUpdateSettings(Settings settings) { try { _unitOfWork.BeginTransaction(); _settingsRepository.AddOrUpdate(settings); var uv = _universityRepository.Find(q => q.Id == settings.UniversityId); uv.Name = settings.University.Name; uv.Address = settings.University.Address; uv.Logo = settings.University.Logo; _universityRepository.Update(uv); _unitOfWork.SaveChanges(); _unitOfWork.CommitTransaction(); return(new Tuple <bool, string>(true, "عملیات ثبت شد")); } catch (Exception ex) { _unitOfWork.Rollback(); return(new Tuple <bool, string>(false, "خطا در انجام عملیات")); } }