Exemplo n.º 1
0
        // 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);
        }
Exemplo n.º 2
0
        // 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);
        }