internal Bazar GetById(long Id)
 {
     Bazar bazars = new Bazar();
     var session = SessionFactory.OpenSession();
     bazars = session.QueryOver<Bazar>().Where(x => x.Id == Id).SingleOrDefault<Bazar>();
     return bazars;
 }
 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");
 }
 internal void Update(Bazar bazar)
 {
     using (ISession session = SessionFactory.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Update(bazar);
             transaction.Commit();
         }
     }
 }
 internal void DeleteMembers(Bazar bazar)
 {
     using (ISession session = SessionFactory.OpenSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Delete(bazar);
             transaction.Commit();
             session.Close();
         }
     }
 }
        public void Save(Bazar bazars)
        {
            using (ISession session = SessionFactory.OpenSession())
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    session.Save(bazars);
                    transaction.Commit();

                }
            }
        }
 public ActionResult EditBazars(Bazar bazar)
 {
     bM.Update(bazar);
     return RedirectToAction("ViewBazarList");
 }
 public ActionResult DeleteBazars(Bazar bazar)
 {
     bM.DeleteMembers(bazar);
     return RedirectToAction("ViewBazarList");
 }