public static bool EmailFavs(FavoritesEmailModel favModel) { using (var client = new LandauPortalWebAPI()) { var emailFav = new EmailFavorite() { Brand = favModel.Brand, EntryDate = DateTime.Now, Message = favModel.Message, RecipientEmail = favModel.RecipientEmail, RecipientName = favModel.RecipientName, SenderName = favModel.FullName, Subject = favModel.Subject, Products = favModel.FavProds != null?favModel.FavProds.Distinct().ToList() : null }; try { client.EmailFavorites.Create(favModel.Brand, emailFav); return(true); } catch (Exception e) { if (e is HttpOperationException) { var httpEx = (HttpOperationException)e; return(httpEx.Response.IsSuccessStatusCode); } } return(false); } }
public ActionResult Email() { this.FillSeoInformation(UrlBuilder.FAVS_EMAIL); var model = new FavoritesEmailModel(); return(View(PathFromView("FavoritesEmail"), model)); }
public ActionResult Email(FavoritesEmailModel model) { if (ModelState.IsValid) { model.Brand = this.CurrentBrand; model.FavProds = string.IsNullOrEmpty(model.FavCodes) ? new List <String>() : model.FavCodes.Split(',').Where(f => !string.IsNullOrEmpty(f)).ToList(); FavoritesManager.EmailFavs(model); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }