public bool EditIntention(IntentionViewModel model, string modifiedBy)
        {
            var intention = base.FindIntentionById(model.Id);

            intention.Name       = model.Name;
            intention.ModifiedBy = modifiedBy;

            this.Data.IntentionRepository.Update(intention);

            return(Convert.ToBoolean(this.Data.SaveChanges()));
        }
Example #2
0
        public IActionResult Put([FromBody] IntentionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                NotifyModelStateErrors();
                return(Response(model));
            }

            intentionAppService.Update(model);

            return(Response(model));
        }
Example #3
0
        public ActionResult Edit([Bind(Include = "Id,Name")] IntentionViewModel intentionModel)
        {
            try
            {
                var intention = this._intentionService.FindIntention(intentionModel.Id);

                if (this.ModelState.IsValid)
                {
                    if (this._intentionService.EditIntention(intentionModel, this.User.Identity.Name))
                    {
                        return(RedirectToAction("Details", "IntentionRecognition", new { id = intention.BotId }));
                    }
                }

                return(View(intention));
            }
            catch (NotFoundException ex)
            {
                return(HttpNotFound(ex.Message));
            }
        }
Example #4
0
        public void Update(IntentionViewModel viewModel)
        {
            var updateCommand = _mapper.Map <UpdateIntentionCommand>(viewModel);

            _bus.SendCommand(updateCommand);
        }
Example #5
0
        public void Create(IntentionViewModel viewModel)
        {
            var command = _mapper.Map <CreateIntentionCommand>(viewModel);

            _bus.SendCommand(command);
        }