private static WebAddress FromWebAddressModelToWebAddress(WebAddressModel webAddressModel) { WebAddress webAddress = new WebAddress(); webAddress.Id = webAddressModel.Id; webAddress.Category = webAddressModel.SocialNetwork; webAddress.Url = webAddressModel.URL; return(webAddress); }
private static WebAddressModel FromWebAddressToWebAddressModel(WebAddress webAddress) { WebAddressModel webAddressModel = new WebAddressModel(); webAddressModel.Id = webAddress.Id; webAddressModel.SocialNetwork = webAddress.Category; webAddressModel.URL = webAddress.Url; return(webAddressModel); }
void AddFavorite(WebAddressModel fav) { var favorites = (List<WebAddressModel>)Session["Favorites"]; if (favorites == null) { favorites = new List<WebAddressModel>(); Session["Favorites"] = favorites; } favorites.Add(fav); }
public ActionResult Add(WebAddressModel userModel) { var favorites = LoadFavorites(); if (ModelState.IsValid) { favorites.Add(userModel); return RedirectToAction("Index"); } return View("Index", favorites); }