// GET: Contact/Details/5 public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Contact contact = db.Contacts.Find(id); if (contact == null) { return HttpNotFound(); } ContactBusinessLayer contactBusinessLayer = new ContactBusinessLayer(); string timestemp = contactBusinessLayer.getTime(contact.TimeStartEnd); if (timestemp != null) { contact.TimeStartEnd = timestemp; } return View(contact); }
// GET: Contact/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } Contact contact = db.Contacts.Find(id); if (contact == null) { return HttpNotFound(); } ContactBusinessLayer contactBusinessLayer = new ContactBusinessLayer(); ViewData["timestemp"] = contactBusinessLayer.getTimeArr(contact.TimeStartEnd); return View(contact); }
// GET: Contact public ActionResult Index() { List<Contact> listContact = db.Contacts.OrderByDescending(c => c.IsDelete).ToList(); string timestemp; ContactBusinessLayer contactBusinessLayer = new ContactBusinessLayer(); List<Contact> listContactIndex = new List<Contact>(); foreach (var item in listContact) { timestemp = contactBusinessLayer.getTime(item.TimeStartEnd); if (timestemp != null) { item.TimeStartEnd = timestemp; listContactIndex.Add(item); } } return View(listContactIndex); }