/// <summary>
        /// Read all Purchase order details
        /// </summary>
        /// <returns>Returns List of Purchase order</returns>
        public ActionResult Read()
        {
            List <POSModel> empList = new List <POSModel>();

            empList = POSDal.Read();
            return(View(empList));
        }
        /// <summary>
        /// Gets the recent changes made in DB
        /// </summary>
        /// <param name="afterDate">Changes made in DB after the mentioned date</param>
        /// <returns></returns>
        public List <POSModel> GetRecentChanges(DateTime afterDate)
        {
            List <POSModel> list   = new List <POSModel>();
            POSDal          posDal = new POSDal();

            list = posDal.Notification(afterDate);
            return(list);
        }
        /// <summary>
        /// Get Recent changes through SqlCacheDependency
        /// </summary>
        /// <returns>Returns Partial view</returns>
        public ActionResult Recent()
        {
            List <POSModel> empList = new List <POSModel>();

            if (System.Web.HttpContext.Current.Cache["RecentPos"] != null)
            {
                empList = System.Web.HttpContext.Current.Cache["RecentPos"] as List <POSModel>;
            }
            else
            {
                string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["POSConnection"].ConnectionString;
                System.Web.Caching.SqlCacheDependencyAdmin.EnableNotifications(connStr);
                System.Web.Caching.SqlCacheDependencyAdmin.EnableTableForNotifications(connStr, "PurchaseOrder");

                SqlCacheDependency sqlDependency = new SqlCacheDependency("CachingPOS", "PurchaseOrder");
                empList = POSDal.Recent();
                System.Web.HttpContext.Current.Cache.Insert("RecentPos", empList, sqlDependency);
            }

            return(PartialView(empList));
        }
 public ActionResult Delete(int id)
 {
     POSModel.Id = id;
     POSModel    = POSDal.GetPurchaseOrder(POSModel);
     return(View(POSModel));
 }
 /// <summary>
 /// Edit Purchase order details for the given id
 /// </summary>
 /// <param name="posModel">POSModel object</param>
 /// <returns>After successful updation redirects to Read method</returns>
 public ActionResult Edit(POSModel posModel)
 {
     POSDal.Update(posModel);
     return(RedirectToAction("Read"));
 }
 public ActionResult Edit(int id)
 {
     POSModel.Id = id;
     POSModel    = POSDal.GetPurchaseOrder(POSModel);
     return(View("Create", POSModel));
 }
 public ActionResult Create(POSModel posModel)
 {
     POSDal.Create(posModel);
     return(RedirectToAction("Read"));
 }