public void InsertStorageOption_WithValidModel_ShouldBeInserted() { SetUp(); var sorageOption = new StorageOption(); _storageOptionService.InsertStorageOption(sorageOption); Assert.Equal(sorageOption, _context.StorageOptions.First()); }
public IActionResult Create([Bind("StorageId,Model,Manufacturer,Price,Type,Capacity")] StorageOption storageOption) { if (ModelState.IsValid) { var image = Request.Form.Files.GetFile("image"); if (image != null) { storageOption.ImgUrl = _driveService.UploadFile(image); } else { storageOption.ImgUrl = Constants.DEFAULT_STORAGE_IMG; } _service.InsertStorageOption(storageOption); return(RedirectToAction(nameof(Index))); } return(View(storageOption)); }