public void addDistrict(string dName) { if (dName.Length > 3) { District newD = new Model.District { Name = dName }; if (uOW.DistrictRepo.All.Where(x => x.Name.Equals(newD.Name, StringComparison.InvariantCultureIgnoreCase)).Count() == 0) { uOW.DistrictRepo.Insert(newD); uOW.Save(); } } }
private void SortCoordinates(District district) { district.Coordinates = district.Coordinates.OrderBy(c => c.Index).ToList(); }
/// <summary> /// Manager method that is used to set specific district object to avialable state. /// It changes object`s Deleted property to false. /// </summary> /// <param name="district"></param> /// <returns></returns> private District SetStateRestored(District district) { uOW.DistrictRepo.SetStateModified(district); district.Deleted = false; uOW.Save(); return district; }
/// <summary> /// Private manager method that incapsulates all logic we need to set specific district entry to deleted state. /// </summary> /// <param name="district">Input paramater that represents object that we need to change.</param> /// <returns></returns> private District SetStateDeleted(District district) { uOW.DistrictRepo.SetStateModified(district); district.Deleted = true; district.ParentId = null; uOW.Save(); return district; }
/// <summary> /// Private managaer method that incapsulates edititng logic. Used by edit method, /// that changes specific district name property. /// </summary> /// <param name="oldDistrict">Input parameter that represents old district entry that we need to change.</param> /// <param name="inputDistrict">Input parameter that represents new district entry that we use to change old entry.</param> /// <returns></returns> private District SetDistrictStateModified(District oldDistrict, District inputDistrict) { oldDistrict.Name = inputDistrict.Name; oldDistrict.Coordinates = inputDistrict.Coordinates; uOW.DistrictRepo.SetStateModified(oldDistrict); uOW.Save(); return oldDistrict; }
public ActionResult DeleteDistrict(District a) { districtManager.deleteById(a.Id); return RedirectToAction("DistrictEditor"); }