Example #1
0
        public ActionResult SaveSLATerm(SLATermModel model)
        {
            if (ModelState.IsValid)
            {
                var slaTerm = _slaTermRepository.GetById(model.Id);
                //always set IsNew to false when saving
                slaTerm.IsNew = false;

                slaTerm = model.ToEntity(slaTerm);

                _slaTermRepository.UpdateAndCommit(slaTerm);
                return(new NullJsonResult());
            }
            else
            {
                return(Json(new { Errors = ModelState.Errors().ToHtmlString() }));
            }
        }
Example #2
0
        public ActionResult CreateSLATerm(long slaDefinitionId)
        {
            var slaTerm = new SLATerm
            {
                IsNew = true
            };

            _slaTermRepository.Insert(slaTerm);

            var slaDefinition = _slaDefinitionRepository.GetById(slaDefinitionId);

            slaDefinition.SLATerms.Add(slaTerm);

            this._dbContext.SaveChanges();

            var model = new SLATermModel();

            model = slaTerm.ToModel();
            var html = this.SLATermPanel(model);

            return(Json(new { Id = slaTerm.Id, Html = html }));
        }
Example #3
0
        public string SLATermPanel(SLATermModel model)
        {
            var html = this.RenderPartialViewToString("_SLATermDetails", model);

            return(html);
        }