Exemplo n.º 1
0
        public ActionResult BaseScoreCard(int id, BaseScoreCardViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var scoreCard = this.baseScoreCardRepository.Find(id, this.Authentication.CurrentUserId);

            model.UpdateScoreCard(scoreCard, this.generalSettings.ScoreCardLifeTime);

            // It is important to note that the JournalScore of the Journal is updated in a
            // trigger in the datavaluation and not in the code. This is done to prevent concurrency
            // issues from leading to incorrect totals and averages for the journal score

            this.baseScoreCardRepository.InsertOrUpdate(scoreCard);
            this.baseScoreCardRepository.Save();

            var journalPrice = this.baseJournalPriceRepository.Find(id, this.Authentication.CurrentUserId);

            model.UpdateJournalPrice(journalPrice);

            this.baseJournalPriceRepository.InsertOrUpdate(journalPrice);
            this.valuationJournalPriceRepository.Save();

            return(this.Json(true));
        }