public ActionResult Save(tblCatalog oCatalog) { if (ModelState.IsValid) { try { bool Add_Flg = new CommonBL().isNewEntry(oCatalog.Id); if (Add_Flg) new CatalogBL().Create(oCatalog); else new CatalogBL().Update(oCatalog); //TempData["successmsg"] = CommonMsg.Success_Update(EntityNames.Company); return RedirectToAction("ManageCatalog", new { id = oCatalog.Id }); } catch (Exception ex) { //TempData["errormsg"] = CommonMsg.Error(); return RedirectToAction("Index"); } } else { //TempData["errormsg"] = CommonMsg.Error(); return RedirectToAction("Index"); } }
public PartialViewResult ManageCatalog(int id) { tblCatalog catalog = new tblCatalog(); if (id != 0) { catalog = new CatalogBL().GetById(id); } ViewBag.Types = new CatalogTypeBL().GetAllCatalogTypes(); return PartialView("_Manage", catalog); }
public void Create(tblCatalog oCatalog) { try { using (var ctx = new CRUDSampleEntities()) { ctx.tblCatalogs.Add(oCatalog); ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public JsonResult IsBarCodeUnique(tblCatalog catalog) { return Json(!new CatalogBL().IsCatalogExist(catalog.CatalogName, catalog.Barcode)); }
public void Update(tblCatalog oCatalog) { try { using (var ctx = new CRUDSampleEntities()) { ctx.Entry(oCatalog).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { throw ex; } }