예제 #1
0
        public ActionResult Edit(int id, EditEvaluationsViewModel model)
        {
            var repository = new EvaluationRepository(context);

            try
            {
                if (ModelState.IsValid)
                {
                    var evaluationUpdate = MapperHelper.Map <Evaluation>(model);
                    repository.Update(evaluationUpdate);
                    context.SaveChanges();
                    var route = (new
                    {
                        controller = "Assignment",
                        action = "Index"
                    });
                    return(RedirectToRoute(route));
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = ex.Message;
                return(View(model));
            }
            return(View(model));
        }
예제 #2
0
        public Guid?Update(EvaluationUpdateModel evaluation)
        {
            var evaluationEntity = mapper.Map <EvaluationEntity>(evaluation);

            return(evaluationRepository.Update(evaluationEntity));
        }