Пример #1
0
 public ViewRepaire(RepaireTablet tablet)
 {
     this.Id           = tablet.Id;
     this.DateRepaire  = tablet.DateRepaire;
     this.RepaireManId = tablet.RepaireManId;
     this.RepaireMan   = tablet.RepaireMan;
     this.SerialNumber = tablet.Tablet.SerialNumber;
     this.Type         = "Tablet";
     this.Model        = tablet.Tablet.Model;
 }
Пример #2
0
        public async Task <IActionResult> CreateTablet([Bind("Id,EquipmentId,RepaireManId,DateRepaire,SoftWare,TabletId")] RepaireTablet repaire)
        {
            repaire.Id = await MaxIdRepaire();

            if (ModelState.IsValid)
            {
                _context.Add(repaire);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Equipment"]  = new SelectList(_context.Tablets, "Id", "Info");
            ViewData["RepaireMan"] = new SelectList(_context.RepaireMen, "Id", "FullName");
            return(View());
        }
Пример #3
0
        // GET: RepaireLists/Details/5
        public async Task <IActionResult> Details(int?id, string type)
        {
            if (id == null || string.IsNullOrEmpty(type))
            {
                return(RedirectToAction(nameof(Index), new { message = "Not found" }));
            }

            switch (type)
            {
            case "Desctop":
            {
                RepairePC repairePC = await
                                      _context.RepairePCs
                                      .Include(i => i.Pc)
                                      .Include(r => r.RepaireMan).ThenInclude(r => r.RepaireLists)
                                      .Select(s => s).FirstOrDefaultAsync(r => r.Id == id);

                return(View("DetailsPc", repairePC));
            }

            case "ThinkClient":
            {
                RepairePC repairePC = await
                                      _context.RepairePCs
                                      .Include(i => i.Pc)
                                      .Include(r => r.RepaireMan).ThenInclude(r => r.RepaireLists)
                                      .Select(s => s).FirstOrDefaultAsync(r => r.Id == id);

                return(View("DetailsPc", repairePC));
            }

            case "Tablet":
            {
                RepaireTablet repaireTablet = await
                                              _context.RepaireTablets
                                              .Include(i => i.Tablet)
                                              .Include(r => r.RepaireMan).ThenInclude(r => r.RepaireLists)
                                              .Select(s => s).FirstOrDefaultAsync(r => r.Id == id);

                return(View("DetailsTablets", repaireTablet));
            }

            default:
            {
                return(RedirectToAction(nameof(Index), new { message = "Not found" }));
            }
            }
        }