public void Add([FromBody] MapLegend item) { using (var repository = new MapLegendRepository()) { var manager = new MapLegendManager(repository); manager.AddOrUpdate(item); } }
// GET api/<controller>/5 /// <summary> /// The get. /// </summary> /// <param name="id"> /// The predicate. /// </param> /// <returns> /// </returns> public MapLegend GetById(int id) { using (var repository = new MapLegendRepository()) { var manager = new MapLegendManager(repository); return(manager.Get().Single(p => p.Id == id)); } }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> public MapLegend GetByName(string name) { using (var repository = new MapLegendRepository()) { var manager = new MapLegendManager(repository); return(manager.Get().Single(p => p.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))); } }
/// <summary> /// The get. /// </summary> /// <returns> /// </returns> public IEnumerable <MapLegend> Get() { using (var repository = new MapLegendRepository()) { var manager = new MapLegendManager(repository); return(manager.Get()); } }