public async Task <IActionResult> GetById(int id) { var item = await _repository.Find(id); if (item == null) { return(NotFound()); } return(Ok(item)); }
/// <summary> /// Delete Area by id /// </summary> public void DeleteArea(long areaId) { Area dbversion = areaRepository.Find((int)areaId); ValidateBeforeDeletion(areaId); if (dbversion == null) { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Area with Id {0} not found!", areaId)); } areaRepository.Delete(dbversion); areaRepository.SaveChanges(); }
public List <bx_area> Find() { var key = "ExternalApi_Area_Find"; lock (key) { var cachelst = CacheProvider.Get <List <bx_area> >(key); if (cachelst == null) { var lst = _areaRepository.Find(); CacheProvider.Set(key, lst); return(lst); } return(cachelst); } }
// GET: /Areas/Details/5 public ViewResult Details(long id) { return(View(areaRepository.Find(id))); }