public ActionResult AddBazarCost(Bazar bazar ,long Members = 0)
 {
     Members member = new Members();
     member = dM.GetById(Members);
     bazar.Members = member;
     bM.Save(bazar);
     return RedirectToAction("ViewBazarList");
 }
        public Members GetById(long Id)
        {
            Members member = new Members();
            var session = SessionFactory.OpenSession();
            member = session.QueryOver<Members>().Where(x => x.Id == Id).SingleOrDefault<Members>();

            return member;
        }
        public Members GetById(long Id)
        {
            Members member = new Members();
            ISession session = SessionFactory.OpenSession();

                member = session.Get<Members>(Id);

            return member;
        }
 internal void Update(Members member)
 {
     using (ISession session = SessionFactory.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Update(member);
             transaction.Commit();
         }
     }
 }
 internal void DeleteMembers(Members member)
 {
     using (ISession session = SessionFactory.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Delete(member);
             transaction.Commit();
             session.Close();
         }
     }
 }
 public void Save(Members members)
 {
     using(ISession session = SessionFactory.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Save(members);
             transaction.Commit();
             session.Close();
         }
     }
 }
 public ActionResult DepositAdd(Deposit deposit, long Members= 0)
 {
     Members member = new Members();
     member = dM.GetById(Members);
     deposit.Members = member;
     string monthName = "";
     int monthNameIntValue = deposit.DepositDate.Month;
     switch (monthNameIntValue)
     {
         case 1: monthName = "January";
             break;
         case 2: monthName = "February";
             break;
         case 3: monthName = "March";
             break;
         case 4: monthName = "April";
             break;
         case 5: monthName = "May";
             break;
         case 6: monthName = "June";
             break;
         case 7: monthName = "July";
             break;
         case 8: monthName = "August";
             break;
         case 9: monthName = "September";
             break;
         case 10: monthName = "October";
             break;
         case 11: monthName = "November";
             break;
         case 12: monthName = "December";
             break;
         default: monthName = "";
             break;
     }
     deposit.MonthName = monthName;
     dM.Save(deposit);
     return RedirectToAction("ViewDepositList");
 }
 public ActionResult MemberAdd(Members members)
 {
     mM.Save(members);
        return RedirectToAction("ViewAllMembers");
 }
 public ActionResult EditMembers(Members member)
 {
     mM.Update(member);
     return RedirectToAction("ViewAllMembers");
 }
 public ActionResult DeleteMembers(Members member)
 {
     mM.DeleteMembers(member);
     return RedirectToAction("ViewAllMembers");
 }
        public ActionResult MealCount(Meal meal, string[] selectedMemberId, long Members = 0)
        {
            try
            {
                for (int i = 0; i < selectedMemberId.Count(); i++)
                {
                    Members members = new Members();
                    members = mM.GetById(Convert.ToInt64(selectedMemberId[i]));
                    meal.Members = members;
                    mMS.Save(meal);
                }
            }
            catch(Exception ex)
            {
                throw ex;
            }

            return RedirectToAction("ViewMeal");
        }