예제 #1
0
        public ActionResult Create(PlantCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new PlantService(userId);

            service.CreatePlant(model);

            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult <PlantDTO> CreatePlant([FromBody] CreatePlantDTO plant)
        {
            Plant newPlant = service.CreatePlant(new Services.Arguments.CreatePlantArguments(plant.Name));

            return(Accepted(mapper.Map <PlantDTO>(newPlant)));
        }