Пример #1
0
        public void UpdateNextRepair(NextRepairDTO nxtRepair)
        {
            NextRepair nr = MyMapper <NextRepairDTO, NextRepair> .Map(nxtRepair);

            DB.NextRepairs.Update(nr);
            DB.Commit();
        }
Пример #2
0
        public ActionResult ConfirmNextRepairDeletion(int id)
        {
            NextRepairDTO nextRepairDTO = _nextRepairService.GetNextRepair(id);

            if (nextRepairDTO != null)
            {
                _nextRepairService.DeleteNextRepair(id);
                return(RedirectToAction("NextRepairs"));
            }
            return(HttpNotFound());
        }
Пример #3
0
        public ActionResult DeleteNextRepair(int id)
        {
            NextRepairDTO nextRepairDTO = _nextRepairService.GetNextRepair(id);

            if (nextRepairDTO != null)
            {
                var nextRepair = MyMapper <NextRepairDTO, NextRepairViewModel> .Map(nextRepairDTO);

                return(View(nextRepair));
            }
            return(HttpNotFound());
        }
Пример #4
0
        public ActionResult EditNextRepair(int id)
        {
            NextRepairDTO nextRepairDTO = _nextRepairService.GetNextRepair(id);

            if (nextRepairDTO != null)
            {
                ViewBag.Repairs     = new SelectList(_nextRepairService.GetRepairTypes(), 1);
                ViewBag.Technicians = new SelectList(_nextRepairService.GetTechniciansNames(), 1);
                var nextRepair = MyMapper <NextRepairDTO, NextRepairViewModel> .Map(nextRepairDTO);

                return(View(nextRepair));
            }
            return(HttpNotFound());
        }
Пример #5
0
        public NextRepairReportInfoDTO GetReport(int?equipmentId)
        {
            EquipmentDTO            equipment  = (new EquipmentService(DB)).GetEquipment(equipmentId.Value);
            NextRepairDTO           nextRepair = (new NextRepairService(DB)).GetNextRepair(equipment.NextRepairs.Where(r => r.EquipmentId == equipmentId.Value).FirstOrDefault().Id) ?? null;
            NextRepairReportInfoDTO report     = new NextRepairReportInfoDTO()
            {
                CurrentDate  = DateTime.Now,
                Equipment    = equipment,
                NextRepair   = nextRepair,
                EquipmentId  = equipmentId.Value,
                NextRepairId = nextRepair.Id
            };

            return(report);
        }