public ActionResult ComplaintCat(tbl_Category_Complaintss model) { try { if (model.pkid == 0) { tbl_Category_Complaint abc = new tbl_Category_Complaint(); abc.CategoryName = model.CategoryName; abc.Description = model.Description; abc.LastModifedDate = DateTime.Now; _catComplaint.Add(abc); } else { int _id = Convert.ToInt32(model.pkid); tbl_Category_Complaint abc = _catComplaint.Get(_id); abc.pkid = model.pkid; abc.CategoryName = model.CategoryName; abc.Description = model.Description; abc.LastModifedDate = DateTime.Now; _catComplaint.Update(abc); } return(RedirectToAction("ComplaintCat", "SystemMaster")); } catch (Exception e) { Commonfunction.LogError(e, Server.MapPath("~/Log.txt")); ViewBag.Exception = e.Message; return(View()); } }
public ActionResult ComplaintCat(string id) { if (!String.IsNullOrWhiteSpace(id)) { int _id = Convert.ToInt32(id); tbl_Category_Complaint model = _catComplaint.Get(_id); tbl_Category_Complaintss abc = new tbl_Category_Complaintss(); abc.pkid = model.pkid; abc.CategoryName = model.CategoryName; abc.Description = model.Description; return(View(abc)); } return(View()); }