public JsonResult DeleteTillLimit(TblTillimit Till)
        {
            var item = RetailUnitOfWork.tillLimit.GetById(Till.Id);

            item.Isdeleted = true;

            RetailUnitOfWork.tillLimit.Update(item);
            RetailUnitOfWork.Commit();
            return(Json(Till.Id));
        }
        public JsonResult updateTillLimit(TblTillimit Till)
        {
            var ledgerAcct = RetailUnitOfWork.tillMapping.GetAll().Where(p => p.Id == Till.Tillmappingid).FirstOrDefault().Accountid;

            Till.Ledgeraccount = ledgerAcct;

            var tillFunct = RetailUnitOfWork.tillFunction.GetAll().Where(p => p.Id == Till.Tillfunctionid).FirstOrDefault().Tillfunction;

            Till.Tillfunction = tillFunct;

            var tillName = RetailUnitOfWork.tillMapping.GetAll().Where(p => p.Id == Till.Tillmappingid).FirstOrDefault().Tilldefinationname;

            Till.Tillname = tillName;

            RetailUnitOfWork.tillLimit.Update(Till);
            RetailUnitOfWork.Commit();
            return(Json(Till.Id));
        }
        public JsonResult AddTillLimit([FromBody] TblTillimit Till)
        {
            Till.Datecreated = DateTime.Now;
            Till.Createdby   = "Peter";
            Till.Branchid    = 3;
            Till.Companyid   = 1;

            if (Till.Ledgeraccount == null || Till.Tillfunction == null || Till.Tillname == null)
            {
                var ledgerAcct = RetailUnitOfWork.tillMapping.GetDetails().Where(p => p.Id == Till.Tillmappingid).FirstOrDefault().Accountid;
                Till.Ledgeraccount = ledgerAcct;

                var tillFunct = RetailUnitOfWork.tillFunction.GetAll().Where(p => p.Id == Till.Tillfunctionid).FirstOrDefault().Tillfunction;
                Till.Tillfunction = tillFunct;

                var tillName = RetailUnitOfWork.tillMapping.GetDetails().Where(p => p.Id == Till.Tillmappingid).FirstOrDefault().Tilldefinationname;
                Till.Tillname = tillName;
            }

            RetailUnitOfWork.tillLimit.Add(Till);
            RetailUnitOfWork.Commit();

            return(Json(Till.Id));
        }