コード例 #1
0
        public ActionResult ViewEdit(SupplierModel supplier)
        {
            if (supplier.SupplierID <= 0)
            {
                SupplierManager.AddSupplier(Utility.convertSrcToTarget<SupplierModel, Supplier>(supplier), "nirshan");
            }
            else
            {
                SupplierManager.UpdateSupplier(Utility.convertSrcToTarget<SupplierModel, Supplier>(supplier), "nirshan");
            }

            return RedirectToAction("Index");
        }
コード例 #2
0
        public ActionResult ViewEdit()
        {
            SupplierModel tmpSupplierModel = null;

            int? supplierId = (int?)TempData["tmpsupplierId"];
            if (supplierId.HasValue == false)
            {
                ViewBag.Title = "Create";
                ViewBag.Command = "Create";
                tmpSupplierModel = new SupplierModel() { IsActive = true };
            }
            else
            {
                ViewBag.Title = "Update";
                ViewBag.Command = "Update";

                Supplier editCustomer = SupplierManager.GetSupplierByID(supplierId.Value, "nirshan");
                tmpSupplierModel = Utility.convertSrcToTarget<Supplier, SupplierModel>(editCustomer);

            }

            return View(tmpSupplierModel);
        }