public ActionResult EditSocial(int socialMediaId) { CommonDataService cds = new CommonDataService(); CommonModel cm = new CommonModel(); cm = cds.GenerateCommonModel(); Session["FaceBook"] = cm.FaceBook; Session["Twitter"] = cm.Twitter; Session["Youtube"] = cm.Youtube; Session["Instagram"] = cm.Instagram; Session["PhoneNumber"] = cm.PhoneNumber; Session["Email"] = cm.Email; Session["ShoppingHours"] = cm.ShoppingHours; try { ContactDataService dataService = new ContactDataService(); SocialMediaModel model = new SocialMediaModel(); model = dataService.GenerateSocialMediaModelById(socialMediaId); return(View(model)); } catch (Exception ex) { throw ex; } }
public ActionResult Edit() { CommonDataService cds = new CommonDataService(); CommonModel cm = new CommonModel(); cm = cds.GenerateCommonModel(); Session["FaceBook"] = cm.FaceBook; Session["Twitter"] = cm.Twitter; Session["Youtube"] = cm.Youtube; Session["Instagram"] = cm.Instagram; Session["PhoneNumber"] = cm.PhoneNumber; Session["Email"] = cm.Email; Session["ShoppingHours"] = cm.ShoppingHours; ContactDataService dataService = new ContactDataService(); ContactViewModel viewModel = new ContactViewModel(); try { viewModel.ContactModel = dataService.GenerateContactModel(); viewModel.AddressModel = dataService.GenerateAddressModel(); viewModel.ContactNumbersModel1 = dataService.GenerateContactNumbersModelById(1); viewModel.ContactNumbersModel2 = dataService.GenerateContactNumbersModelById(2); viewModel.ContactNumbersModel3 = dataService.GenerateContactNumbersModelById(3); viewModel.ContactNumbersModel4 = dataService.GenerateContactNumbersModelById(4); viewModel.ContactNumbersModel5 = dataService.GenerateContactNumbersModelById(5); viewModel.EmailAddressModel = dataService.GenerateEmailAddressModelById(1); viewModel.ShoppingHoursModel = dataService.GenerateShoppingHoursModelById(1); viewModel.ContactAdditionalModel = dataService.GenerateContactAdditionalModelById(1); viewModel.SocialMediaModelFacebook = dataService.GenerateSocialMediaModelById(1); viewModel.SocialMediaModelTwitter = dataService.GenerateSocialMediaModelById(2); viewModel.SocialMediaModelYoutube = dataService.GenerateSocialMediaModelById(3); viewModel.SocialMediaModelInstagram = dataService.GenerateSocialMediaModelById(4); return(View(viewModel)); } catch (Exception ex) { throw ex; } finally { dataService = null; viewModel = null; } }