Esempio n. 1
0
        public async Task <IActionResult> GetServices(AssignedSueeper obj, string sortOrder, string currentFilter, string searchString, int?pageIndex)
        {
            var serviceslist = (from details in db.PersonalInfo
                                join Add in db.AddressInfo on details.Id equals Add.PersonalInfoId
                                join TimeP in db.TimeDateInfo on details.Id equals TimeP.PersonalInfoId
                                join paytbl in db.PaymentTbl on details.Id equals paytbl.ServiceId

                                select new Getmodel
            {
                Id = details.Id,
                FirstName = details.FirstName,
                LastName = details.LastName,

                Phone = details.Phone,
                ZipCode = details.ZipCode,
                dateofservice = TimeP.DateOfService,
                timeofservice = TimeP.TimeOfService,
                Email = details.Email,
            }).OrderByDescending(m => m.Id);
            var sueeperList = db.SueeperInfo;

            ViewBag.Sueepers = new SelectList(sueeperList, "Id", "Name");
            if (obj.PersonaLInfoId != null && obj.SueeperId != null)
            {
                Assignsueeper tbl = new Assignsueeper();
                tbl.PersonaLInfoId = Convert.ToInt32(obj.PersonaLInfoId);
                tbl.sueeperId      = Convert.ToInt32(obj.SueeperId);
                tbl.JobStatus      = "Incoming";
                tbl.Dateofservice  = obj.dateofservice;
                tbl.Timeofservice  = obj.timeofservice;
                tbl.journeystatus  = "Pending";
                tbl.createDate     = DateTime.Now;
                db.AssinSueeper.Add(tbl);
                db.SaveChanges();

                ViewBag.IsAssigned = 1;
            }
            if (!string.IsNullOrEmpty(searchString))
            {
                try
                {
                    serviceslist = (IOrderedQueryable <Getmodel>)serviceslist.Where(t => (t.FirstName + t.LastName + t.PersonName + t.ZipCode + t.Phone).ToLower().Contains(searchString.ToLower()));
                }
                catch (Exception)
                {
                }
            }
            int pageSize = 15;

            getModel = await PaginatedList <Getmodel> .CreateAsync(
                serviceslist.AsNoTracking(), pageIndex ?? 1, pageSize);

            getModel.CurrentFilter = searchString;
            return(View(getModel));
        }
Esempio n. 2
0
 public IActionResult AssignSueeper(AssignedSueeper obj)
 {
     return(RedirectToAction("GetServices"));
 }