public ActionResult Create(string contactId) { var oid = ControllerHelpers.GetObjectId(contactId); var model = new InstantMessengerModel { ContactId = oid, }; return(View(model)); }
public ActionResult Delete(InstantMessengerModel model) { try { instantMessengerService.RemoveContactInstantMessenger(model.ContactId, model.Id); return(RedirectToAction("Index", new { id = model.ContactId })); } catch (Exception ex) { ViewBag.ErrorMessage = ex.Message; return(View(model)); } }
public ActionResult Edit(InstantMessengerModel model) { if (ModelState.IsValid) { try { instantMessengerService.UpdateContactInstantMessenger(model.ContactId, model.ToEntity()); return(RedirectToAction("Index", new { id = model.ContactId })); } catch (Exception ex) { ViewBag.ErrorMessage = ex.Message; return(View(model)); } } return(View(model)); }
public static InstantMessenger ToEntity(this InstantMessengerModel contactModel) { return(Mapper.Map <InstantMessengerModel, InstantMessenger>(contactModel)); }