예제 #1
0
        // GET: Repairs
        public IActionResult Index()
        {
            var repair = _repairRepository.GetAll().Include(r => r.Appointment).ThenInclude(v => v.Vehicle).ThenInclude(b => b.Brand)
                         .Include(r => r.Appointment).ThenInclude(c => c.Client)
                         .Include(r => r.Appointment).ThenInclude(c => c.Mechanic)
                         .Include(r => r.Appointment).ThenInclude(c => c.AppointmentType).ToList();

            foreach (var rep in repair) //formatar a data
            {
                rep.FormatedDate = rep.CompletedAt.ToString("dd/MM/yyyy hh:mm");
            }

            return(View(repair));
        }
        public IActionResult MyRepairs()
        {
            var repair = _repairRepository.GetAll().Include(m => m.Appointment).ThenInclude(c => c.Client)
                         .Include(m => m.Appointment).ThenInclude(c => c.Mechanic)
                         .Include(m => m.Appointment).ThenInclude(c => c.Vehicle)
                         .Include(m => m.Appointment).ThenInclude(c => c.AppointmentType)
                         .Where(p => p.Appointment.Mechanic.User.Email == User.Identity.Name);

            var rmodel = new MecRepairsViewModel
            {
                Repairs = repair
            };

            return(View(rmodel));
        }
예제 #3
0
        public ActionResponse <IQueryable <RepairDto> > GetAll(params Enums.Status[] statuses)
        {
            var response = _repairRepository.GetAll(statuses);

            return(response);
        }