public ActionResult Create()
 {
     var brands = _brandRepository.GetAll().OrderBy(brand => brand.Name).ToList();
     brands.Insert(0, new Brand { Id = 0, Name = "Har ingen merke" });
     ViewData["Brands"] = brands;
     var viewmodel = new IngredientViewModel
                         {
                             Quantities =
                                 Mapper.Map<IEnumerable<QuantityType>, IEnumerable<QuantityTypeViewModel>>(
                                     _quantityTypeRepository.GetAll())
                         };
     return View(viewmodel);
 }
 public ActionResult Create(IngredientViewModel viewModel)
 {
     var brands = _brandRepository.GetAll().OrderBy(brand => brand.Name).ToList();
     brands.Insert(0, new Brand { Id = 0, Name = "Har ingen merke" });
     ViewData["Brands"] = brands;
     try
     {
         viewModel.DateAdded = DateTime.Now;
         _ingredientRepository.Create(Mapper.Map<IngredientViewModel, Ingredient>(viewModel));
         return RedirectToAction("Create");
     }
     catch
     {
         return View(viewModel);
     }
 }