//
        // GET: /Details/5
        public ActionResult Index(int id)
        {
            var context = new BehvazanBioDataContext();
            var details = context.Details.FirstOrDefault(d => d.ID == id);

            return View(details);
        }
        //
        // GET: /Gallery/5
        public ActionResult Index(int id)
        {
            var context = new BehvazanBioDataContext();
            var gallery = context.Gallery.FirstOrDefault(d => d.ID == id);
            
            var galleryViewModel = new Behevazan.UI.Models.GalleryViewModel();

            galleryViewModel.Gallery = gallery;
            galleryViewModel.Images = context.GalleryImage.Where(it => it.GalleryID == gallery.ID).ToList();
            
            return View(galleryViewModel);
        }
Example #3
0
        //
        // GET: /News/5
        public ActionResult Index(int id)
        {
            var context = new BehvazanBioDataContext();
            var news = context.Details.FirstOrDefault(d => d.ID == id);
            
            var newsViewModel = new Behevazan.UI.Models.NewsViewModel();

            newsViewModel.News = news;

            newsViewModel.NewsList = context.Details.Where(d => d.Category.Order == 3 && d.LanguageID == languageID).ToList();

            foreach (var item in newsViewModel.NewsList)
            {
                if (string.IsNullOrEmpty(item.Content))
                {
                    item.Content = item.Content.Substring(0, Math.Min(item.Content.Length, 100));
                }
            }

            return View(newsViewModel);
        }
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer<BehvazanBioDataContext>(null);

                try
                {
                    using (var context = new BehvazanBioDataContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("BehvazanBio.Repository.BehvazanBioDataContext", "UserProfile", "ID", "UserName", autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The AAASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }