Пример #1
0
        public void InsertStorageOption_WithValidModel_ShouldBeInserted()
        {
            SetUp();

            var sorageOption = new StorageOption();

            _storageOptionService.InsertStorageOption(sorageOption);

            Assert.Equal(sorageOption, _context.StorageOptions.First());
        }
Пример #2
0
 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));
 }