Example #1
0
        public ActionResult EditUpdate(UpdateFormModel newupdate)
        {
            Update update = Mapper.Map <UpdateFormModel, Update>(newupdate);

            if (ModelState.IsValid)
            {
                update.Goal = goalService.GetGoal(newupdate.GoalId);
                updateService.EditUpdate(update);
                var Updates = Mapper.Map <IEnumerable <Update>, IEnumerable <UpdateViewModel> >(updateService.GetUpdatesByGoal(newupdate.GoalId));
                foreach (var item in Updates)
                {
                    item.IsSupported = updateSupportService.IsUpdateSupported(item.UpdateId, User.Identity.GetUserId());
                }
                UpdateListViewModel updates = new UpdateListViewModel()
                {
                    Updates = Updates,
                    Metric  = goalService.GetGoal(newupdate.GoalId).Metric,
                    Target  = goalService.GetGoal(newupdate.GoalId).Target
                };
                return(PartialView("_UpdateView", updates));
            }
            return(null);
        }