public ActionResult Create(Tamu tamu) { //cek apakah user sudah login if (Session["username"] == null) { if (User.Identity.IsAuthenticated) { Session["username"] = User.Identity.Name; } else { var tempUser = Guid.NewGuid().ToString(); Session["username"] = tempUser; } } using (TamuDAL tmbh = new TamuDAL()) { try { tmbh.TambahTamu(tamu); } catch (Exception ex) { throw new Exception(ex.Message); } } return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { using (TamuDAL service = new TamuDAL()) { service.Delete(id); } return(RedirectToAction("Index")); }
public ActionResult Edit(Tamu tamu) { using (TamuDAL services = new TamuDAL()) { services.Edit(tamu); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { using (TamuDAL services = new TamuDAL()) { var result = services.GetItemByID(id); return(View(result)); } }
public ActionResult Create(Tamu tamu) { using (TamuDAL service = new TamuDAL()) { service.Add(tamu); } return(RedirectToAction("Index")); }
public ActionResult Search(string txtSearch) { using (TamuDAL svCat = new TamuDAL()) { var results = svCat.Search(txtSearch).ToList(); return(View("Index", results)); } }
// GET: Tamu public ActionResult Index() { using (TamuDAL tamu = new TamuDAL()) { string username = Session["username"] != null ? Session["username"].ToString() : string.Empty; return(View(tamu.GetData().ToList())); } }
public ActionResult IndexUser() { string username = Session["username"].ToString(); using (TamuDAL service = new TamuDAL()) { return(View(service.GetDataByUsername(username).ToList())); } }
// GET: Tamu public ActionResult Index() { using (TamuDAL service = new TamuDAL()) { var model = service.GetData().ToList(); if (TempData["Pesan"] != null) { ViewBag.Pesan = TempData["Pesan"].ToString(); } return(View(model)); } }
public ActionResult Create() { if (User.Identity.IsAuthenticated) { using (TamuDAL service = new TamuDAL()) { string username = Session["username"] != null ? Session["username"].ToString() : string.Empty; return(View(service.GetByUser(username))); } } else { return(RedirectToAction("Login", "Account")); } }