public ActionResult DeleteConfirmed(int id) { Mcontact mcontact = db.Contact.Find(id); db.Contact.Remove(mcontact); db.SaveChanges(); return(RedirectToAction("Trash")); }
public ActionResult Retrash(int id) { Mcontact mcontact = db.Contact.Find(id); mcontact.Status = 2; db.Entry(mcontact).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Trash", "Contact")); }
public ActionResult deleteTrash(int id) { Mcontact mcontact = db.Contacts.Find(id); db.Contacts.Remove(mcontact); db.SaveChanges(); Message.set_flash("Đã xóa vĩnh viễn 1 Liên Hệ", "success"); return(RedirectToAction("trash")); }
public ActionResult Edit([Bind(Include = "Id,FullName,Email,Phone,Title,Detail,Created_at,Updated_at,Updated_by,Status")] Mcontact mcontact) { if (ModelState.IsValid) { db.Entry(mcontact).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mcontact)); }
public ActionResult Create([Bind(Include = "Id,FullName,Email,Phone,Title,Detail,Created_at,Updated_at,Updated_by,Status")] Mcontact mcontact) { if (ModelState.IsValid) { db.Contact.Add(mcontact); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mcontact)); }
public ActionResult Retrash(int id) { Mcontact mcontact = db.Contacts.Find(id); mcontact.status = 2; mcontact.updated_at = DateTime.Now; mcontact.updated_by = int.Parse(Session["Admin_id"].ToString()); db.Entry(mcontact).State = EntityState.Modified; db.SaveChanges(); Message.set_flash("khôi phục thành công", "success"); return(RedirectToAction("trash")); }
public ActionResult Status(int id) { Mcontact mcontact = db.Contacts.Find(id); mcontact.status = (mcontact.status == 1) ? 2 : 1; mcontact.updated_at = DateTime.Now; mcontact.updated_by = int.Parse(Session["Admin_id"].ToString()); db.Entry(mcontact).State = EntityState.Modified; db.SaveChanges(); Message.set_flash("Thay đổi trang thái thành công", "success"); return(RedirectToAction("Index")); }
// GET: Admin/Contact/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mcontact mcontact = db.Contact.Find(id); if (mcontact == null) { return(HttpNotFound()); } return(View(mcontact)); }
public string ShowStatus(int id) { string strStatus = ""; Mcontact mcontact = db.Contact.Find(id); if (mcontact.Status == 1) { strStatus = "<span class='btn btn-info btn-sm' ><i class='fas fa-toggle-on'></i>TT</span>"; } else { strStatus = "<span class='btn btn-danger btn-sm' ><i class=' fas fa-toggle-off'></i>TT</span>"; } return(strStatus); }
public ActionResult status(int id) { Mcontact mcontact = db.Contact.Find(id); if (mcontact.Status == 1) { mcontact.Status = 2; } else { mcontact.Status = 1; } db.Entry(mcontact).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Nhanlienket(Mcontact contact) { if (ModelState.IsValid) { contact.created_at = DateTime.Now; contact.updated_by = 1; contact.updated_at = DateTime.Now; contact.updated_by = 1; contact.status = 2; db.Contacts.Add(contact); db.SaveChanges(); Message.set_flash("Gửi liên hệ thành công", "success"); return(RedirectToAction("Index")); } Message.set_flash("Gửi liên hệ thất bại", "danger"); return(View()); }
public RedirectResult Savecontact() { string fullname = Request.Form["FullName"]; string email = Request.Form["Email"]; string phone = Request.Form["Phone"]; string title = Request.Form["Title"]; string detail = Request.Form["Detail"]; Mcontact contact = new Mcontact(); contact.FullName = fullname; contact.Email = email; contact.Phone = phone; contact.Title = title; contact.Detail = detail; contact.Created_at = DateTime.Now; contact.Updated_at = DateTime.Now; contact.Updated_by = 1; contact.Status = 1; db.Contact.Add(contact); db.SaveChanges(); return(Redirect("~/lien-he")); }