Ejemplo n.º 1
0
        public async Task <IHttpActionResult> Put(Guid id, OrderAddOrUpdateViewModel model)
        {
            var serviceRes = await _orderService.Edit(new OrderEditRequest()
            {
                RequestOwner = User,
                Model        = model,
                Id           = id
            });

            IHttpActionResult res = BadRequest();

            if (serviceRes.Access == ResponseAccess.Granted)
            {
                res = Ok(serviceRes);
            }
            if (serviceRes.Access == ResponseAccess.Deny)
            {
                res = Unauthorized(serviceRes.Message);
            }

            return(res);
        }
 public static void MapToExisting(this OrderAddOrUpdateViewModel order, Order exiting)
 {
     Mapper.Map(order, exiting);
 }
 public static Order MapToModel(this OrderAddOrUpdateViewModel order)
 {
     return(Mapper.Map <Order>(order));
 }