public async Task <IActionResult> Create(Plant plant) { await _plantService.Create(plant).ConfigureAwait(false); var statusCode = new StatusCodeResult(200); return(statusCode); }
// POST: api/Plant public async Task <IHttpActionResult> Post(PlantModel plant) { if (!ModelState.IsValid) { return(BadRequest()); } var userId = await UserService.GetUserId(User.Identity.Name); var plantDTO = new PlantDTO { Name = plant.Name, ApplicationUserId = userId }; await PlantService.Create(plantDTO); return(Ok()); }
public Plant Post([FromBody] Plant camera) { return(_plantService.Create(camera)); }
public ActionResult <Plant> Create(Plant plant) { _plantService.Create(plant); return(CreatedAtRoute("GetPlant", new { id = plant.Id.ToString() }, plant)); }
public Plant PostCamera([FromBody] Plant plant, int id) { plant.Labfarm = _labfarmService.GetById(id); return(_plantService.Create(plant)); }