public IHttpActionResult GetType(int id)
        {
            OrderTypeDTO entity = Service.GetType(id);

            if (entity == null)
            {
                return(NotFound());
            }

            return(Ok(entity));
        }
        public IHttpActionResult PostType(OrderTypeDTO obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bool result = Service.AddType(obj);

            return(CreatedAtRoute("DefaultApi", new { id = obj.ID }, obj));
        }
        public bool UpdateType(OrderTypeDTO obj)
        {
            OrderType entity = new OrderType();

            entity = Mapper.Map <OrderTypeDTO, OrderType>(obj);
            unitofwork.OrderType.Update(entity);
            try
            {
                unitofwork.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool AddType(OrderTypeDTO obj)
        {
            var entity = Mapper.Map <OrderTypeDTO, OrderType>(obj);

            unitofwork.OrderType.Add(entity);
            try
            {
                unitofwork.SaveChanges();
                return(true);
            }

            catch
            {
                return(false);
            }
        }
        public IHttpActionResult PutTransactionType(int id, OrderTypeDTO obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != obj.ID)
            {
                return(BadRequest());
            }

            Service.UpdateType(obj);


            return(StatusCode(HttpStatusCode.NoContent));
        }