public JsonResult DeleteVendorTermination(VendorTermination termination)
 {
     bool result = false;
     using (this.UoW)
     {
         this.UoW.VendorTerminations.Delete(termination);
         result = this.UoW.Commit() > 0;
     }
     return Json(new { Success = result });
 }
        public JsonResult SaveVendorTermination(VendorTermination termination)
        {
            DateTime Now = DateTime.Now;
            string UserName = System.Web.HttpContext.Current.User.Identity.Name;
            var result = false;

            if (ModelState.IsValid)
            {
                using (this.UoW)
                {
                    if (termination.VendorTerminationID == Guid.Empty)
                    {
                        termination.InputDate = Now;
                        termination.InputBy = UserName;
                        termination.LastModifiedDate = Now;
                        termination.VendorTerminationID = Guid.NewGuid();
                        this.UoW.VendorTerminations.Insert(termination);
                        result = this.UoW.Commit() > 0;
                    }
                    else
                    {
                        TGFContext db = new TGFContext();
                        termination.LastModifiedBy = UserName;
                        termination.LastModifiedDate = Now;
                        this.UoW.VendorTerminations.Update(termination);
                        result = this.UoW.Commit() > 0;
                    }
                }
                //return Json(new { Success = result, VendorShipTo = termination });
                return Json(new { Success = result});
            }
            else
            {
                return Json(new { Success = result, Message = "Invalid Model" });
            }
        }
 //public JsonResult GetVendorTerminations1(Guid vendorId, int pageSize, int currentPage)
 //{
 //    TGFContext db = new TGFContext();
 //    db.Configuration.ProxyCreationEnabled = false;
 //    var terminationsQuery = db.VendorTerminations.Include("Division1").Include("TerminationReason1").Where(c => c.VendorID == vendorId);
 //    var rowCount = terminationsQuery.Count();
 //    var terminations = terminationsQuery.OrderByDescending(s => s.TerminationDate).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
 //    return Json(new { Data = terminations, VirtualRowCount = rowCount }, JsonRequestBehavior.AllowGet);
 //}
 public JsonResult SaveVendorTermination(VendorTermination termination)
 {
     var result = false;
     if (ModelState.IsValid)
     {
         using (this.UoW)
         {
             if (termination.VendorTerminationID == Guid.Empty)
             {
                 termination.InputDate = DateTime.Now;
                 termination.LastModifiedDate = DateTime.Now;
                 termination.VendorTerminationID = Guid.NewGuid();
                 this.UoW.VendorTerminations.Insert(termination);
                 result = this.UoW.Commit() > 0;
             }
             else
             {
                 TGFContext db = new TGFContext();
                 termination.LastModifiedDate = DateTime.Now;
                 this.UoW.VendorTerminations.Update(termination);
                 result = this.UoW.Commit() > 0;
             }
         }
         return Json(new { Success = result, VendorShipTo = termination });
     }
     else
     {
         return Json(new { Success = result, Message = "Invalid Model" });
     }
 }