コード例 #1
0
 public IActionResult CreateOrderItems(OrderItems orders)
 {
     if (ModelState.IsValid)
     {
         repo.Create(orders);
         return(Redirect("ViewOrderItems"));
     }
     return(View("CreateOrderItems"));
 }
コード例 #2
0
        public JsonResult AjaxCreate(Orders_Items orderItem)
        {
            if (Authorized(RoleType.OrdersWriter))
            {
                bool wasCreated;
                using (OrderItemsRepository itemRep = new OrderItemsRepository(CurrentUser.CompanyId, orderItem.SupplierId))
                {
                    wasCreated = itemRep.Create(orderItem);
                }

                if (wasCreated)
                    return Json(new { success = true, message = String.Empty, newItemId = orderItem.Id }, JsonRequestBehavior.AllowGet);
                else
                    return Json(new { success = false, message = Loc.Dic.error_supplier_item_create_error }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { success = false, message = Loc.Dic.error_no_permission }, JsonRequestBehavior.AllowGet);
            }
        }
コード例 #3
0
        public JsonResult AjaxCreate(Orders_Items orderItem)
        {
            if (Authorized(RoleType.OrdersWriter))
            {
                bool wasCreated;
                using (OrderItemsRepository itemRep = new OrderItemsRepository(CurrentUser.CompanyId, orderItem.SupplierId))
                {
                    wasCreated = itemRep.Create(orderItem);
                }

                if (wasCreated)
                {
                    return(Json(new { success = true, message = String.Empty, newItemId = orderItem.Id }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = false, message = Loc.Dic.error_supplier_item_create_error }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { success = false, message = Loc.Dic.error_no_permission }, JsonRequestBehavior.AllowGet));
            }
        }