Beispiel #1
0
        public ActionResult Create(string contactId)
        {
            var oid   = ControllerHelpers.GetObjectId(contactId);
            var model = new InstantMessengerModel {
                ContactId = oid,
            };

            return(View(model));
        }
Beispiel #2
0
 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));
     }
 }
Beispiel #3
0
        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));
        }
Beispiel #4
0
 public static InstantMessenger ToEntity(this InstantMessengerModel contactModel)
 {
     return(Mapper.Map <InstantMessengerModel, InstantMessenger>(contactModel));
 }