Example #1
0
 public IActionResult Create(Bike b)
 {
     if (ModelState.IsValid)
     {
         _repository.Create(b);
         return RedirectToAction("Details", new { id = b.Id });
     }
     return View(b);
 }
Example #2
0
        public void CreateBike(BikeViewModel model, string userId, byte[] imageData)
        {
            var res = _userManagerService.GetUserById(userId);

            _bikeRepository.Create(new Bike
            {
                Name        = model.Name,
                MaxSpeed    = model.MaxSpeed,
                TypeEngine  = model.TypeEngine,
                Power       = model.Power,
                Fuel        = model.Fuel,
                Description = model.Description,
                AccountId   = res.Result.Id,
                Price       = model.Price,
                BikeImg     = imageData
            });
            _commitProvider.Save();
        }