public Evaluation CreateEvaluation(Evaluation evaluation) { return(ServiceErrorHandler.Handle(() => { Log.Info("Creating the Evaluation"); IEvaluationsDao dao = this.evaluationDaoBuilder.Create(); evaluation.CreationDate = DateTime.Now.ToUniversalTime(); evaluation.EditDate = DateTime.Now.ToUniversalTime(); var template = ServicesFacade.Instance.GetTemplatesService().GetTemplate(evaluation.IdTemplate); EvaluationValidator.Validate(evaluation, template); Evaluation newEvaluation = dao.CreateEvaluation(evaluation); Log.Info($"Evaluation Created Succesfully, Id {newEvaluation.Id}"); return newEvaluation; })); }
public Evaluation CreateEvaluation(Evaluation evaluation) { var template = new Template() { Id = Guid.Parse("00000001-0000-0000-0000-000000000000"), EvalNameMaxChars = 150, AllowedCharsRule = @"^[\w\s]+$", ValueRequired = true, Name = "Evaluation Header Test Template", ScoreFormula = "sum(i, 0, questionsLength, questionScore(i))", Headers = new List <DataField> { new TextField() { Id = Guid.Parse("00000001-0001-0000-0000-000000000000"), AllowedCharsRule = @"^[\w\s]+$", ValueRequired = true, Input = false, Label = "Title", Type = DataFieldType.Text, MinChar = 4, MaxChar = 150 } } }; try { EvaluationValidator.Validate(evaluation, template); return(evaluation); } catch (ValidationErrorServiceException) { throw; } }