public ActionResult Create(About collection) { try { AboutDao bdDao = new AboutDao(); UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION]; collection.CreateBy = us.UserName; collection.CreateDate = Hepper.GetDateServer(); collection.ModifiedBy = us.UserName; collection.ModifiedDate = Hepper.GetDateServer(); collection.LanguageID = "vi"; //collection.CreateBy = us.UserName; //collection.ModifiedBy = us.UserName; if (bdDao.Insert(collection)) { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success"); return(RedirectToAction("Index")); } else { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger"); } return(RedirectToAction("Index")); } catch { SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger"); return(View()); } }
public ActionResult Create(About model) { if (ModelState.IsValid) { var dao = new AboutDao(); long id = dao.Insert(model); if (id > 0) { return(RedirectToAction("Index", "About")); } else { ModelState.AddModelError("", "Them about thanh cong"); } } return(View("Index")); }
public ActionResult Create(About about) { if (ModelState.IsValid) { var dao = new AboutDao(); long id = dao.Insert(about); if (id > 0) { setAlert("Thêm thông tin thành công", "success"); return(RedirectToAction("Index", "About")); } else { setAlert("Cập nhật thông tin thành công", "success"); ModelState.AddModelError("", "Không thêm được"); } } return(View("Index")); }
public ActionResult Create(About about) { if (ModelState.IsValid) { var dao = new AboutDao(); about.CreateDate = DateTime.Now; about.ModifiedDate = DateTime.Now; long id = dao.Insert(about); if (id > 0) { SetAlert("Add user successfully", "success"); return(RedirectToAction("Index", "About")); } else { SetAlert("Add user failure", "danger"); ModelState.AddModelError("", "Add failure"); } } return(View("Index")); }
public ActionResult Create(About model) { if (ModelState.IsValid) { var session = (UserLogin)Session[CommonConstants.USER_SESSION]; model.CreatedBy = session.UserName; var dao = new AboutDao(); long id = dao.Insert(model); if (id > 0) { SetAlert("Thêm thông tin thành công", "success"); return(RedirectToAction("Index", "About")); } else { SetAlert("Thêm user không thành công", "error"); ModelState.AddModelError("", "Thêm thông tin không thành công"); } } return(View()); }