public async Task <IActionResult> Update([FromBody] Plant plant) { if (_plantService.IsExisting(plant)) { return(StatusCode((int)HttpStatusCode.Conflict)); } var dbPlant = _repository.GetById <Plant>(plant.Id); if (dbPlant == null) { return(NotFound()); } dbPlant.Name = plant.Name; dbPlant.GaiaCode = plant.GaiaCode; dbPlant.CountryId = plant.CountryId; dbPlant.SOAId = plant.SOAId; _repository.Update(dbPlant); _repository.Save(); await _plantService.PublishSaveEventAsync(dbPlant); return(NoContent()); }
public async Task <IActionResult> Delete(int id) { var dbUser = _repository.GetById <User>(id); if (dbUser == null) { return(NotFound()); } dbUser.IsDeleted = true; _repository.Update(dbUser); _repository.Save(); await _userService.PublishSaveEventAsync(dbUser.Id); return(NoContent()); }