public AboutUsModel GenerateAboutUsModel() { AboutUsModel aum = new AboutUsModel(); try { using (VenturadaDataContext vdc = new VenturadaDataContext()) { var aboutus = from about in vdc.AboutUs.ToList() orderby about.AboutUsId ascending select about; aum = new AboutUsModel(); aum.AboutUsId = aboutus.FirstOrDefault().AboutUsId; aum.AboutUsParagraph = aboutus.FirstOrDefault().AboutUsParagraph; aum.AboutUsTitle = aboutus.FirstOrDefault().AboutUsTitle; aum.ImageUrl = aboutus.FirstOrDefault().ImageUrl; return aum; } } catch (Exception ex) { throw ex; } }
public void UpdateAboutUs(AboutUsModel aum) { try { AboutUs au = new AboutUs(); using (VenturadaDataContext vdc = new VenturadaDataContext()) { au = vdc.AboutUs.Single(a => a.AboutUsId == aum.AboutUsId); au.AboutUsId = aum.AboutUsId; au.AboutUsParagraph = aum.AboutUsParagraph; au.AboutUsTitle = aum.AboutUsTitle; vdc.SubmitChanges(); } } catch (Exception ex) { throw ex; } }