public ActionResult Add(string materialNumber, string MATERIALIDVENDOR, string MATERIALTYPE, string MATERIALGROUP, string OLDMATERIAL, string BOMMATERIAL, string BRAND, string MODEL, string GARDAN, string YEAR, string PURCHASEGROUPID, string DESCRIPTION, string PRICELIST) { try { MSMATERIAL model = new MSMATERIAL(); model.MATERIALNUMBER = materialNumber; model.MATERIALIDVENDOR = MATERIALIDVENDOR; model.MATERIALGROUP = MATERIALGROUP; model.OLDMATERIAL = OLDMATERIAL; model.BRAND = BRAND; model.MODEL = MODEL; model.GARDAN = GARDAN; model.YEAR = YEAR; model.PURCHASEGROUPID = PURCHASEGROUPID; model.DESCRIPTION = DESCRIPTION; model.PRICELIST = PRICELIST == "" ? 0 : double.Parse(PRICELIST); IMaterialService svc = new MaterialService(); var result = svc.Add(model); this.AddNotification("Your Data Has Been Successfully Saved. ", NotificationType.SUCCESS); return(RedirectToAction("Index")); } catch (Exception ex) { general.AddLogError("Material Add", ex.Message, ex.StackTrace); this.AddNotification("ID exist", NotificationType.ERROR); this.ViewBag.purchaseId = GetPurchaseID(); return(View("~/Views/Master/Material/Add.cshtml")); //throw; } }
public void Add(MATERIAL entity) { try { materialS.Add(entity); } catch (Exception e) { throw e; } }
public ActionResult Create(Material material) { if (ModelState.IsValid) { materialService.Add(material); string url = Url.Action("Index", "Material", new { id = material.Id }); return(Json(new { success = true, url = url })); } return(PartialView("_Create", material)); }