//add a new flower public IActionResult AddFlower(AddFlowerViewModel addFlowerViewModel) { if (!ModelState.IsValid) { return(View(addFlowerViewModel)); } var flower = new Flower { //add new //name Name = addFlowerViewModel.Name, //short description ShortDescription = addFlowerViewModel.ShortDescription, //long description LongDescription = addFlowerViewModel.LongDescription, //price Price = addFlowerViewModel.Price, //image url ImageUrl = addFlowerViewModel.ImageUrl, //image thumbail ImageThumbnailUrl = addFlowerViewModel.ImageThumbnailUrl, //if it appears in the main presentation IsFlowerPresentation = addFlowerViewModel.IsFlowerPresentation, //if is in stock InStock = addFlowerViewModel.InStock, //category id CategoryId = addFlowerViewModel.CategoryId, }; _flowerRepository.AddFlower(flower); return(RedirectToAction(FManagement, _flowerRepository.Flowers)); }