Beispiel #1
0
        public async Task <IActionResult> Add([FromBody] MetadataValueViewModel model)
        {
            try
            {
                model.Id          = new Guid();
                model.IsActivated = true;
                await _metadataValueService.CreateAsync(model);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Beispiel #2
0
        public async Task <ActionResult> Update([FromBody] MetadataValueViewModel model)
        {
            try
            {
                var model_db = await _metadataValueService.FindByIdAsync(model.Id);

                if (model_db == null)
                {
                    return(BadRequest("Model is not exists"));
                }
                model_db = model;
                await _metadataValueService.UpdateAsync(model_db, model_db.Id);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }