Example #1
0
        public bool Edit(TrainingDataViewModel model, string modifiedBy)
        {
            var data = base.FindTrainingDataById(model.Id);

            data.Content    = model.Content;
            data.ModifiedBy = modifiedBy;

            this.Data.TrainingDataRepository.Update(data);

            return(Convert.ToBoolean(this.Data.SaveChanges()));
        }
        public ActionResult Edit([Bind(Include = "Id,Content,IntentionId")] TrainingDataViewModel dataModel)
        {
            try
            {
                var data = this._trainingDataService.Find(dataModel.Id);

                if (this.ModelState.IsValid)
                {
                    if (this._trainingDataService.Edit(dataModel, this.User.Identity.Name))
                    {
                        return(RedirectToAction("Details", "Intention", new { id = data.IntentionId }));
                    }
                }

                return(View(data));
            }
            catch (NotFoundException ex)
            {
                return(HttpNotFound(ex.Message));
            }
        }