public EvaluationDetailModel GetById(Guid id) { var evaluationEntity = evaluationRepository.GetById(id); evaluationEntity.Product = productRepository.GetById(evaluationEntity.ProductId); return(mapper.Map <EvaluationDetailModel>(evaluationEntity)); }
public ActionResult AddOrUpdate(EvaluationModel model) { if (!ModelState.IsValid) { return(View(model)); } var isCreated = model.Id == Guid.Empty; var evaluation = new Evaluations(); if (!isCreated) { evaluation = EvaluationRepository.GetById(model.Id); } evaluation.Date = model.Date; evaluation.Classroom_Id = model.ClassroomId; evaluation.Classrooms = ClassroomRepository.GetById(model.ClassroomId); evaluation.User_Id = model.UserId; evaluation.Users = UserRepository.GetById(model.UserId); evaluation.TotalPoint = model.TotalPoint; evaluation.Periods = PeriodRepository.GetById(model.PeriodId); if (isCreated) { EvaluationRepository.Add(evaluation); } EvaluationRepository.Save(); return(Redirect(Url.Action("Get", "Evaluation", new { id = evaluation.Id }))); }
public ActionResult AddAllByEval(Guid evalId) { var eval = EvaluationRepository.GetById(evalId); var model = new AddAllByEvalModel { EvalId = eval.Id, Results = eval.Classrooms.Pupils.Select(p => new OneResult { Pupil = new ModelWithNameAndId { Id = p.Id, Name = p.FirstName + " " + p.LastName }, Note = p.Results.SingleOrDefault(r => r.Evaluations.Id == evalId)?.Note ?? 0 }).ToList() }; return(View(model)); }
public ActionResult AddOrUpdate(Guid?Id, Guid?classroomId) { var model = new EvaluationModel(); model.Date = DateTime.Now; if (Id.HasValue) { model = EvaluationModel.ToModel(EvaluationRepository.GetById(Id.Value)); } if (classroomId.HasValue) { model.ClassroomId = classroomId.Value; } return(View(model)); }
public ActionResult Get(Guid id) { var model = EvaluationModel.ToModel(EvaluationRepository.GetById(id)); return(View(model)); }