public IEnumerable<Indulgence> AllIndulgencesForSin(Sin sin)
 {
     return _session.CreateCriteria<Indulgence>()
         .SetMaxResults(1000)
         .Add(Restrictions.Eq("Sin.Id", sin.Id))
         .AddOrder(Order.Desc("DateConfessed"))
         .List<Indulgence>();
 }
        public ActionResult Index(string confession)
        {
            // store the confession as a sin
            var sin = new Sin() { Content = confession, Source = "JC" };
            MvcApplication.CurrentSession.Store(sin);

            Indulgence con = new Indulgence()
            {
                Confession = confession.Truncate(150),
                DateConfessed = DateTime.Now,
                IsBlessed = false,
                IsConfession = true,
                SinId = sin.Id,
                Tweeted=false,
                Name="Anonymous"
            };
            MvcApplication.CurrentSession.Store(con);

            MvcApplication.CurrentSession.SaveChanges();

            return RedirectToAction("Confess", new {id=con.Id.IdValue()});
        }
        public ActionResult BeginConfession(string confession)
        {
            // store the confession as a sin
            Indulgence indulgence = null;
            var sin = new Sin() { Content = confession, Source = "JC", Guid=Guid.NewGuid() };

            indulgence = new Indulgence()
            {
                Confession = confession.Truncate(150),
                DateConfessed = DateTime.Now,
                IsBlessed = false,
                IsConfession = true,
                Sin = sin,
                Tweeted = false,
                Name = "Anonymous",
                Guid=Guid.NewGuid(),
                BackgroundImageName = "parchment3"
            };
            _indulgeMeService.SaveIndulgence(indulgence);

            return RedirectToAction("Confess", new { guid = indulgence.Guid });
        }
 public IEnumerable<Indulgence> AllIndulgencesForSin(Sin sin)
 {
     return _db.Where(o => o is Indulgence).Select(o => o as Indulgence).Where(i=>i.Sin.Id==sin.Id);
 }
 public IEnumerable <Indulgence> AllIndulgencesForSin(Sin sin)
 {
     return(_db.Where(o => o is Indulgence).Select(o => o as Indulgence).Where(i => i.Sin.Id == sin.Id));
 }