// POST: api/Unit public ServerResponse Post([FromBody] Unit unit) { var res = new ServerResponse(); using (UnitBL unitBL = new UnitBL()) { try { res.Data = unitBL.SaveUnit(unit); } catch (Exception ex) { res.Success = false; } } return(res); }
// GET: api/Unit/5 public ServerResponse Get(string id) { var res = new ServerResponse(); using (UnitBL unitBL = new UnitBL()) { try { res.Data = unitBL.GetUnit(id); } catch (Exception ex) { res.Success = false; } } return(res); }