public async Task Update(KitchenDto model) { var basketContent = new StringContent(JsonConvert.SerializeObject(model), System.Text.Encoding.UTF8, "application/json"); var response = await _apiClient.PostAsync("", basketContent); _kitchenSender.SendWaitList(model); response.EnsureSuccessStatusCode(); }
public void SendWaitList(KitchenDto customer) { var factory = new ConnectionFactory() { HostName = _hostname, UserName = _username, Password = _password }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: _queueName, durable: false, exclusive: false, autoDelete: false, arguments: null); var json = JsonConvert.SerializeObject(customer); var body = Encoding.UTF8.GetBytes(json); channel.BasicPublish(exchange: "", routingKey: _queueName, basicProperties: null, body: body); } }
public async Task <ActionResult <List <KitchenDto> > > GetKitchenAsync() { PantryPlannerUser user = null; try { user = await _userManager.GetUserFromCookieOrJwtAsync(this.User); } catch (PermissionsException e) { // this will be thrown if the user is null return(Unauthorized(e.Message)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } try { List <Kitchen> kitchens = _service.GetAllKitchensForUser(user); return(Ok(KitchenDto.ToList(kitchens))); } catch (ArgumentNullException e) { return(BadRequest(e.Message)); } catch (UserNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
public Model.Kitchen CreateUpdate(KitchenDto model) { return(new Model.Kitchen(model.Title, model.Image, model.Description, model.OrganizationUnitId, model.IsDeleted, model.CreatorUserId, model.CreationTime, model.LastModifierUserId, model.LastModificationTime, model.DeleterUserId, model.DeletionTime)); }
public async System.Threading.Tasks.Task <KitchenDto> Update(KitchenDto model) { return(ObjectMapper.Map <KitchenDto>(await _kitchen.UpdateAsync(_kitchenAdapter.CreateUpdate(model)))); }
public async System.Threading.Tasks.Task Create(KitchenDto model) { await _kitchen.InsertAsync(_kitchenAdapter.CreateUpdate(model)); }