//
 // GET: /ElectronicMail/Delete/5
 public ActionResult Delete(int id)
 {
     ElectronicMail electronicMail = _repository.Get(id);
     var emailViewModel = new ElectronicMailViewModel
                              {
                                  Id = electronicMail.Id,
                                  CustomerId = electronicMail.CustomerId,
                                  Email = electronicMail.Email,
                                  IsPrimary = electronicMail.IsPrimary,
                                  ModifiedDate = electronicMail.ModifiedDate
                              };
     return View(emailViewModel);
 }
 public ActionResult Create(int customerId, ElectronicMail electronicMail)
 {
     try
     {
         _repository.Add(customerId, electronicMail);
         var emailViewModel = new ElectronicMailViewModel
                                  {
                                      Id = electronicMail.Id,
                                      CustomerId = electronicMail.CustomerId,
                                      Email = electronicMail.Email,
                                      IsPrimary = electronicMail.IsPrimary,
                                      ModifiedDate = electronicMail.ModifiedDate
                                  };
         return RedirectToAction("Index", emailViewModel);
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Delete(int id, ElectronicMail electronicMail)
 {
     try
     {
         ElectronicMail toDelete = _repository.Get(id);
         _repository.Delete(id);
         var emailViewModel = new ElectronicMailViewModel
                                  {
                                      Id = electronicMail.Id,
                                      CustomerId = toDelete.CustomerId,
                                      Email = toDelete.Email,
                                      IsPrimary = toDelete.IsPrimary,
                                      ModifiedDate = toDelete.ModifiedDate
                                  };
         return RedirectToAction("Index", emailViewModel);
     }
     catch
     {
         return View();
     }
 }
 //
 // GET: /ElectronicMail/Details/5
 public ActionResult Details(int id)
 {
     ElectronicMail electronicMail = _repository.Get(id);
     var toDisplay = new ElectronicMailViewModel
                         {
                             Id = electronicMail.Id,
                             CustomerId = electronicMail.CustomerId,
                             Email = electronicMail.Email,
                             IsPrimary = electronicMail.IsPrimary,
                             ModifiedDate = electronicMail.ModifiedDate
                         };
     return toDisplay.Id > 0 ? View(toDisplay) : View("No data found");
 }