public async Task Create(UserScore model)
        {
            model.Created = DateTime.Now;
            model.Updated = DateTime.Now;
            this.db.UserScore.Add(model);

            await this.db.SaveChangesAsync();
        }
        public async Task Edit(UserScore model)
        {
            var score = await this.FindOne(model.Id);

            score.Updated = DateTime.Now;
            score.Score   = model.Score;
            score.Note    = model.Note;
            await this.db.SaveChangesAsync();
        }
Beispiel #3
0
        public async Task <ActionResult> Edit(int id, UserScore model)
        {
            var score = await this.userScoreRepository.FindOne(id);

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await this.userScoreRepository.Edit(model);

            return(RedirectToAction("History", "Score", new { userId = score.AuthorId }));
        }
Beispiel #4
0
        public async Task <ActionResult> AddScore(string userId, UserScore model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = await userRepository.GetUserById(userId);

            model.AuthorId = user.Id;

            await this.userScoreRepository.Create(model);

            return(RedirectToAction("History", "Score", new { userId = user.Id }));
        }
 public async Task Delete(UserScore model)
 {
     this.db.UserScore.Remove(model);
     await this.db.SaveChangesAsync();
 }