Beispiel #1
0
        public IActionResult Create([FromBody] VendorViewModel vendor)
        {
            if (vendor == null)
            {
                return(BadRequest());
            }

            var id = _vendorService.Add(vendor);

            return(Created($"api/Vendor/{id}", id));  //HTTP201 Resource created
        }
 public ActionResult Add(VendorViewModel model)
 {
     try
     {
         IVendorService objIVS = new VendorService();
         var            result = objIVS.Add(model);
         this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         general.AddLogError("Vendor Add", ex.Message, ex.StackTrace);
         this.AddNotification("ID exist", NotificationType.ERROR);
         return(View("~/Views/Master/Vendor/Add.cshtml"));
     }
 }
 public IActionResult Post([FromBody] Vendor vendor)
 {
     _vendorService.Add(vendor);
     return(new JsonResult(vendor));
 }