Ejemplo n.º 1
0
        public ActionResult PurchasingViewNew(APIPurchasing purchase)
        {
            if (!ModelState.IsValid)
            {
                return(View("PurchasingViewNew", purchase));
            }

            PurchasingList.GetData().Add(purchase);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
    public static void UpdateItem(APIPurchasing postedItem)
    {
        var editedModel = PurchasingList.GetData().First(i => i.ID == postedItem.ID);

        editedModel.IssueDate   = postedItem.IssueDate;
        editedModel.PostingDate = postedItem.PostingDate;
        editedModel.Supplier    = postedItem.Supplier;
        editedModel.Status      = postedItem.Status;
        editedModel.Description = postedItem.Description;
    }
Ejemplo n.º 3
0
        public ActionResult PurchasingViewNew(int id)
        {
            APIPurchasing purchase = PurchasingList.GetData().FirstOrDefault(U => U.ID == id);

            if (purchase == null)
            {
                purchase    = new APIPurchasing();
                purchase.ID = id;
            }
            return(View("PurchasingViewNew", purchase));
        }
Ejemplo n.º 4
0
        public ActionResult PurchasingViewDelete(int id)
        {
            var model     = PurchasingList.GetData();
            var modelItem = model.FirstOrDefault(it => it.ID == id);

            if (modelItem != null)
            {
                PurchasingList.GetData().Remove(modelItem);
            }
            ;
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        public ActionResult PurchasingViewEdit(APIPurchasing purchase)
        {
            if (!ModelState.IsValid)
            {
                return(View("PurchasingViewEdit", purchase));
            }

            var model     = PurchasingList.GetData();
            var modelItem = model.FirstOrDefault(it => it.ID == purchase.ID);

            if (modelItem != null)
            {
                this.UpdateModel(modelItem);
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public ActionResult PurchasingPartialDelete(System.Int32 ID)
        {
            var model = new object[0];

            if (ID >= 0)
            {
                try
                {
                    // Insert here a code to delete the item from your model
                    PurchasingList.DeleteItem(ID);
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            return(PartialView("_PurchasingPartial", PurchasingList.GetData()));
        }
Ejemplo n.º 7
0
        public ActionResult PurchasingPartialUpdate(MVC.Areas.Purchasing.Models.APIPurchasing item)
        {
            var model = new object[0];

            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model

                    PurchasingList.UpdateItem(item);
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_PurchasingPartial", PurchasingList.GetData()));
        }
Ejemplo n.º 8
0
        public ActionResult PurchasingViewEdit(int id)
        {
            APIPurchasing purchase = PurchasingList.GetData().FirstOrDefault(U => U.ID == id);

            return(View("PurchasingViewEdit", purchase));
        }
Ejemplo n.º 9
0
        public ActionResult PurchasingPartial()
        {
            var model = new object[0];

            return(PartialView("_PurchasingPartial", PurchasingList.GetData()));
        }
Ejemplo n.º 10
0
    public static void DeleteItem(int ma)
    {
        var deleteItem = PurchasingList.GetData().First(i => i.ID == ma);

        PurchasingList.GetData().Remove(deleteItem);
    }
Ejemplo n.º 11
0
 public static void AddItem(APIPurchasing postedItem)
 {
     PurchasingList.GetData().Add(postedItem);
 }