public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Mounting mounting) { if (id != mounting.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mounting); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MountingExists(mounting.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(mounting)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Mounting mounting) { if (ModelState.IsValid) { _context.Add(mounting); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(mounting)); }
internal async Task <Container> ValidateContainerAsync(IdentityDataContext context, ApplicationUser user) { if (string.IsNullOrWhiteSpace(ContainerName)) { throw new ArgumentNullException(nameof(ContainerName)); } Container = new Container { Name = ContainerName }; Volume = await context.Volume.FirstAsync(v => v.VolumeID == VolumeID); Image = await context.Image.FirstAsync(v => v.VolumeID == ImageID); Container.Image = Image; Container.ImageID = Image.VolumeID; Volume publicVolume = await context.Volume.FirstAsync(x => x.UserID == user.Id && x.Path == VolumePath.Public); Volume dataVolume = await context.Volume.FirstAsync(x => x.UserID == user.Id && x.Path == VolumePath.Data); Mounting publicMounting = new Mounting { Volume = publicVolume, Container = this.Container, User = user, UserID = user.Id }; Mounting dataMounting = new Mounting { Volume = dataVolume, Container = this.Container, User = user, UserID = user.Id }; Mounting homeMounting = new Mounting { Volume = this.Volume, Container = this.Container, User = user, UserID = user.Id }; Container.Mountings = new Mounting[] { publicMounting, dataMounting, homeMounting }; Container.User = user; Container.UserID = user.Id; return(Container); }
public Window GetWindow() { Window newWindow; switch (Task.TaskType) { case TaskTypeEnum.AlgorithmDescription: { newWindow = new AlgorithmDescription(Task); return(newWindow); } case TaskTypeEnum.DriversProject: { newWindow = new DriversProject(Task); return(newWindow); } case TaskTypeEnum.ElectricalProject: { newWindow = new ElectricalProject(Task); return(newWindow); } case TaskTypeEnum.Maintainence: { newWindow = new MaintainenceWnd(Task); return(newWindow); } case TaskTypeEnum.Mounting: { newWindow = new Mounting(Task); return(newWindow); } case TaskTypeEnum.OrderList: { newWindow = new OrderList(Task); return(newWindow); } case TaskTypeEnum.ProjectDescription: { newWindow = new ProjectDescriptionWindow(Task); return(newWindow); } case TaskTypeEnum.VarDefTool: { newWindow = new VarDefTool(Task); return(newWindow); } case TaskTypeEnum.Workshop: { newWindow = new Workshop(Task); return(newWindow); } default: { return(null); } } }