Ejemplo n.º 1
0
        public async Task <IActionResult> Update(SpVendors spVendors, string Name, int id)
        {
            var allVendors = new SpVendors();

            if (string.IsNullOrEmpty(spVendors.Name))
            {
                ModelState.AddModelError(nameof(spVendors.Name), "Please enter the Vendor's name");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        // Settings.
                        allVendors = await this.databaseManager.UpdateVendors(Name, id);

                        ViewBag.Result = "Success";
                    }
                }
                catch (Exception ex)
                {
                    // Info
                    Console.Write(ex);
                }
                return(View(allVendors));
            }
            else
            {
                return(View(allVendors));
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(SpVendors spVendors, string Name)
        {
            var allVendors = new SpVendors();

            if (string.IsNullOrEmpty(spVendors.Name))
            {
                ModelState.AddModelError(nameof(spVendors.Name), "Please enter the Vendor's name");
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        // Settings.
                        allVendors = await this.databaseManager.AddVendors(Name);

                        ViewBag.Result = "Success";
                    }
                }
                catch (Exception ex)
                {
                    // Info
                    Console.Write(ex);
                }
                return(View(allVendors));
                //return RedirectToAction("Index", "Vendor");
                //return RedirectToAction("Create", "Vendor", new { dis = ViewData["display"] });
            }
            else
            {
                return(View(allVendors));
            }
        }
Ejemplo n.º 3
0
 public IActionResult Update(SpVendors vendors, string Name)
 {
     ViewData["Name"] = Name;
     return(View(vendors));
 }
Ejemplo n.º 4
0
 public IActionResult Delete(SpVendors vendors, int id)
 {
     vendors.VendorId = id;
     return(View(vendors));
 }