Exemple #1
0
        public async Task <IActionResult> CreateDishe(DisheDTO dishe)
        {
            var result = matrixService.CreateDishe(dishe);

            if (string.IsNullOrEmpty(result))
            {
                return(Conflict());
            }
            return(Ok(result));
        }
Exemple #2
0
        public async Task <string> UpdateDishe(DisheDTO model)
        {
            var data = ConvertObjToJsonStringContent(model);

            using (HttpResponseMessage responseMessage = await apiClient.PostAsync(RecipeApiEndpoints.DishCreate, data))
            {
                if (responseMessage.IsSuccessStatusCode)
                {
                    var result = await responseMessage.Content.ReadAsAsync <string>();

                    return(result);
                }
                else
                {
                    throw new Exception(responseMessage.ReasonPhrase);
                }
            }
        }
        public string CreateDishe(DisheDTO model)
        {
            try
            {
                var client = GetGraphClient();

                var disheDB = mapper.Map <Dishe>(model);
                disheDB.Id = GenerateStringId();

                client.Connect();
                client.Cypher
                .Create("(d:Dishe {newDishe})")
                .WithParam("newDishe", disheDB)
                .ExecuteWithoutResults();

                return(disheDB.Id);
            }
            catch (Exception ex)
            {
                Serilog.Log.Error(ex.Message);
                return(null);
            }
        }
Exemple #4
0
 public void InitComponent(DisheDTO disheDTO)
 {
     this.SelectedDishe = disheDTO;
     this.Name          = SelectedDishe.Name;
 }