Esempio n. 1
0
        public dynamic Update(DeliveryOrder model)
        {
            try
            {
                var data = _deliveryOrderService.GetObjectById(model.Id);
                data.SalesOrderId = model.SalesOrderId;
                data.WarehouseId  = model.WarehouseId;
                data.DeliveryDate = model.DeliveryDate;
                model             = _deliveryOrderService.UpdateObject(data, _salesOrderService, _warehouseService);
            }
            catch (Exception ex)
            {
                LOG.Error("Update Failed", ex);
                model.Errors.Add("Generic", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
        public dynamic Update(DeliveryOrder model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Edit", Core.Constants.Constant.MenuName.DeliveryOrder, Core.Constants.Constant.MenuGroupName.Transaction))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Edit record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                var data = _deliveryOrderService.GetObjectById(model.Id);
                data.SalesOrderId = model.SalesOrderId;
                data.WarehouseId  = model.WarehouseId;
                data.DeliveryDate = model.DeliveryDate;
                model             = _deliveryOrderService.UpdateObject(data, _salesOrderService, _warehouseService);
            }
            catch (Exception ex)
            {
                LOG.Error("Update Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }