public ViewRepaire(RepairePC pc) { this.Id = pc.Id; this.DateRepaire = pc.DateRepaire; this.RepaireManId = pc.RepaireManId; this.RepaireMan = pc.RepaireMan; this.SerialNumber = pc.Pc.SerialNumber; this.Type = pc.Pc.Discriminator; this.Model = pc.Pc.Model; }
public async Task <IActionResult> CreatePc([Bind("Id,EquipmentId,RepaireManId,DateRepaire,SoftWare,HardWare, PcId")] RepairePC repaire) { repaire.Id = await MaxIdRepaire(); if (ModelState.IsValid) { _context.Add(repaire); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["Equipment"] = new SelectList(_context.Pcs, "Id", "Info"); ViewData["RepaireMan"] = new SelectList(_context.RepaireMen, "Id", "FullName"); return(View("CreatePc")); }
// 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" })); } } }