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

            if (string.IsNullOrEmpty(result))
            {
                return(Conflict());
            }
            return(Ok(result));
        }
示例#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);
                }
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public void InitComponent(DisheDTO disheDTO)
 {
     this.SelectedDishe = disheDTO;
     this.Name          = SelectedDishe.Name;
 }