public Task DeleteFile(string id, SyncTarget target, CancellationToken cancellationToken) { _logger.Debug("Deleting file {0} from {1}", id, target.Name); var googleCredentials = GetGoogleCredentials(target); return(_googleDriveService.DeleteFile(id, googleCredentials, cancellationToken)); }
public IActionResult Edit(int id, [Bind("RamId,Model,Manufacturer,MemoryType,MemoryCapacity,MemoryFrequency,Price")] MemoryOption memoryOption) { if (id != memoryOption.MemoryOptionId) { return(NotFound()); } if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { _driveService.DeleteFile(Request.Form["ImgUrl"]); memoryOption.ImgUrl = _driveService.UploadFile(image); } _service.Update(memoryOption); return(RedirectToAction(nameof(Index))); } return(View(memoryOption)); }
public IActionResult Edit(int id, [Bind("MotherboardId,Model,Manufacturer,Price,CpuSocket")] Motherboard motherboard) { if (id != motherboard.MotherboardId) { return(NotFound()); } if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { _driveService.DeleteFile(Request.Form["ImgUrl"]); motherboard.ImgUrl = _driveService.UploadFile(image); } _service.Update(motherboard); return(RedirectToAction(nameof(Index))); } return(View(motherboard)); }
public IActionResult Edit(int id, [Bind("CpuId,Model,Price,Manufacturer,Socket,NumberOfCores,CacheMemory")] Cpu cpu) { if (id != cpu.CpuId) { return(NotFound()); } if (ModelState.IsValid) { _driveService.DeleteFile(Request.Form["ImgUrl"]); var image = Request.Form.Files.GetFile("image"); if (image != null) { cpu.ImgUrl = _driveService.UploadFile(image); } _service.Update(cpu); return(RedirectToAction(nameof(Index))); } return(View(cpu)); }
public IActionResult Edit(int id, [Bind("StorageId,Model,Manufacturer,Price,Type,Capacity")] StorageOption storageOption) { if (id != storageOption.StorageOptionId) { return(NotFound()); } if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { _driveService.DeleteFile(Request.Form["ImgUrl"]); storageOption.ImgUrl = _driveService.UploadFile(image); } _service.Update(storageOption); return(RedirectToAction(nameof(Index))); } return(View(storageOption)); }
public IActionResult Edit(int?id, [Bind("GpuId,Model,Manufacturer,Price,Memory")] Gpu gpu) { if (id != gpu.GpuId) { return(NotFound()); } if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { _driveService.DeleteFile(Request.Form["ImgUrl"]); gpu.ImgUrl = _driveService.UploadFile(image); } _service.Update(gpu); return(RedirectToAction(nameof(Index))); } return(View(gpu)); }
public IActionResult Edit(int id, [Bind("CaseId,Model,Manufacturer,Price,Type")] Case @case) { if (id != @case.CaseId) { return(NotFound()); } if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { string oldImg = Request.Form["ImgUrl"]; _driveService.DeleteFile(oldImg); @case.ImgUrl = _driveService.UploadFile(image); } _service.Update(@case); return(RedirectToAction(nameof(Index))); } return(View(@case)); }
public IActionResult Edit(int id, [Bind("SystemBuildId,Price")] SystemBuild systemBuild) { if (id != systemBuild.SystemBuildId) { return(NotFound()); } string cpuModel = Request.Form["cpus"].ToString(); string caseModel = Request.Form["cases"].ToString(); string gpuModel = Request.Form["gpus"].ToString(); string memoryOptionModel = Request.Form["memoryoption"].ToString(); string motherboardModel = Request.Form["motherboards"].ToString(); string storageOptionModel = Request.Form["storageoption"].ToString(); string name = Request.Form["Name"].ToString(); string description = Request.Form["Description"].ToString(); if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); string imageUrl = string.Empty; if (image != null) { _driveService.DeleteFile(Request.Form["ImgUrl"]); imageUrl = _driveService.UploadFile(image); } else { imageUrl = Constants.DEFAULT_BUILD_IMG; } _service.Update(cpuModel, caseModel, gpuModel, memoryOptionModel, motherboardModel, storageOptionModel, name, description, id, imageUrl); return(RedirectToAction(nameof(Index))); } return(View(systemBuild)); }
public Task DeleteFile(string id, SyncTarget target, CancellationToken cancellationToken) { var googleCredentials = GetGoogleCredentials(target); return(_googleDriveService.DeleteFile(id, googleCredentials, cancellationToken)); }