public ActionResult TourismSubcate(tbl_Tourism_SubCategoryss model) { ViewBag.catList = new SelectList(_catTourism.GetAll(), "pkid", "Category_Name"); try { if (model.pkid == 0) { tbl_Tourism_SubCategory abc = new tbl_Tourism_SubCategory(); abc.SubCategory_Name = model.SubCategory_Name; abc.SubCategory_Description = model.SubCategory_Description; abc.Category_fkid = model.Category_fkid; abc.LastModifiedDate = DateTime.Now; _subcatTourism.Add(abc); } else { int _id = Convert.ToInt32(model.pkid); tbl_Tourism_SubCategory abc = _subcatTourism.Get(_id); abc.pkid = model.pkid; abc.SubCategory_Name = model.SubCategory_Name; abc.Category_fkid = model.Category_fkid; abc.SubCategory_Description = model.SubCategory_Description; abc.LastModifiedDate = DateTime.Now; _subcatTourism.Update(abc); } return(RedirectToAction("TourismSubcate", "SystemMaster")); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); ViewBag.Exception = e.Message; return(View()); } }
public ActionResult TourismSubcate(string id) { ViewBag.catList = new SelectList(_catTourism.GetAll(), "pkid", "Category_Name"); if (!String.IsNullOrWhiteSpace(id)) { int _id = Convert.ToInt32(id); tbl_Tourism_SubCategory model = _subcatTourism.Get(_id); tbl_Tourism_SubCategoryss abc = new tbl_Tourism_SubCategoryss(); abc.pkid = model.pkid; abc.Category_fkid = model.Category_fkid; abc.SubCategory_Name = model.SubCategory_Name; abc.SubCategory_Description = model.SubCategory_Description; return(View(abc)); } return(View()); }