public PartialViewResult LienHe(string title, string category, CMS_Contact obj, FormCollection fc) { try { ViewBag.abc = title; ViewBag.CATE = category; if (ModelState.IsValid) { CMS_Contact_DAO objDAO = new CMS_Contact_DAO(); obj.Title = fc["xTitle"].ToString(); int ReturnID = objDAO.Insert(obj); if (ReturnID > 0) { SetAlert("Gửi thông tin liên hệ thành công", AlertType.Success); } } CMS_Contact n = new CMS_Contact(); return(PartialView(null)); } catch (Exception ex) { Logs.WriteLog(ex); return(PartialView()); } }
public ActionResult Create(FormCollection fc, CMS_Contact obj) { try { if (ModelState.IsValid) { CMS_Contact_DAO objDAO = new CMS_Contact_DAO(); int ReturnID = objDAO.Insert(obj); if (ReturnID > 0) { SetAlert("Thêm thông tin liên hệ thành công", AlertType.Success); return(RedirectToAction("Index", "CMS_Contact")); } else { ModelState.AddModelError("", "Thêm thông tin liên hệ không thành công"); } return(View("Index")); } return(View()); } catch (Exception ex) { SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error); Logs.WriteLog(ex); return(View()); } }