예제 #1
0
        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");
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
파일: CatalogBL.cs 프로젝트: niminc/MVCDemo
 public void Create(tblCatalog oCatalog)
 {
     try
     {
         using (var ctx = new CRUDSampleEntities())
         {
             ctx.tblCatalogs.Add(oCatalog);
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public JsonResult IsBarCodeUnique(tblCatalog catalog)
 {
     return Json(!new CatalogBL().IsCatalogExist(catalog.CatalogName, catalog.Barcode));
 }
예제 #5
0
파일: CatalogBL.cs 프로젝트: niminc/MVCDemo
 public void Update(tblCatalog oCatalog)
 {
     try
     {
         using (var ctx = new CRUDSampleEntities())
         {
             ctx.Entry(oCatalog).State = EntityState.Modified;
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }