Changes in / [728eb31:806f4ee]


Ignore:
Location:
src
Files:
4 added
22 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-facade.service.ts

    r728eb31 r806f4ee  
    22import { Injectable } from '@angular/core';
    33import { Action, Store } from '@ngrx/store';
    4 import { Observable, Subject } from 'rxjs';
    5 import { filter } from 'rxjs/operators';
     4import { Observable, Subject, throwError } from 'rxjs';
     5import { catchError, filter, map } from 'rxjs/operators';
    66
    77import {
     
    99  PreviewQuestionViewModel,
    1010  QuestionStateViewModel,
    11   SearchQuestionsQueryViewModel,
    12   VoteType
     11  SearchQuestionsQueryViewModel
    1312} from 'src/app/shared-app/models';
    1413import {
     
    1716  GetPreviewQuestionsPopular,
    1817  GetQuestionState,
    19   GetSearchQuestions,
    20   VoteAnswer
     18  GetSearchQuestions
    2119} from './question-state/question.actions';
    2220import { questionStateQuery } from './question-state/question.selectors';
     
    3230
    3331  constructor(private store: Store<QuestionState>) {
    34     this.effectWorking$ = this.store.select(questionStateQuery.effectWorking).pipe(filter((effect) => effect !== null));
     32    this.effectWorking$ = this.store.select(questionStateQuery.effectWorking).pipe(
     33      filter((effect) => effect !== null),
     34      map((effect) => {
     35        if (effect instanceof HttpErrorResponse) {
     36          throw effect;
     37        } else {
     38          return effect;
     39        }
     40      }),
     41      catchError((err) => {
     42        return throwError(err);
     43      })
     44    );
    3545  }
    3646
     
    7181  }
    7282
    73   public voteAnswer(answerUid: string, questionUid: string, voteType: VoteType): void {
    74     this.dispatchEffect(new VoteAnswer(questionUid, answerUid, voteType));
    75   }
    76 
    7783  public fetchQuestion(questionUid: string): void {
    7884    this.dispatchEffect(new GetQuestionState(questionUid));
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.actions.ts

    r728eb31 r806f4ee  
    22import { Action } from '@ngrx/store';
    33
    4 import {
    5   PreviewQuestionViewModel,
    6   QuestionStateViewModel,
    7   SearchQuestionsQueryViewModel,
    8   VoteAnswerViewModel,
    9   VoteType
    10 } from 'src/app/shared-app/models';
     4import { PreviewQuestionViewModel, QuestionStateViewModel, SearchQuestionsQueryViewModel } from 'src/app/shared-app/models';
    115
    126export enum QuestionActionTypes {
     
    1913  GetSearchQuestions = '[Question] Get search questions',
    2014  GetSearchQuestionsSuccess = '[Question] Get search questions Success',
    21   VoteAnswer = '[Question] Vote answer',
    22   VoteAnswerSuccess = '[Question] Vote answer Success',
    2315  EffectStartedWorking = '[Question] Effect Started Working',
    2416  EffectFinishedWorking = '[Question] Effect Finished Working',
     
    7466}
    7567
    76 export class VoteAnswer implements Action {
    77   readonly type = QuestionActionTypes.VoteAnswer;
    78 
    79   constructor(public questionUid: string, public answerUid: string, public voteType: VoteType) {}
    80 }
    81 
    82 export class VoteAnswerSuccess implements Action {
    83   readonly type = QuestionActionTypes.VoteAnswerSuccess;
    84 
    85   constructor(public payload: VoteAnswerViewModel) {}
    86 }
    87 
    8868export class EffectStartedWorking implements Action {
    8969  readonly type = QuestionActionTypes.EffectStartedWorking;
     
    10989  | GetPreviewQuestionsPopularSuccess
    11090  | GetSearchQuestionsSuccess
    111   | VoteAnswerSuccess
    11291  | EffectStartedWorking
    11392  | EffectFinishedWorking
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.effects.ts

    r728eb31 r806f4ee  
    77import { BaseApiService } from 'src/app/shared-app/services/base-api.service';
    88import { QuestionFacadeService } from '../question-facade.service';
    9 import { VoteAnswerRequest } from './question-state-request.models';
    10 import { PreviewQuestionResponse, QuestionStateResponse, VoteAnswerResponse } from './question-state-response.models';
     9import { PreviewQuestionResponse, QuestionStateResponse } from './question-state.models';
    1110import {
    1211  EffectFinishedWorking,
     
    2019  GetSearchQuestions,
    2120  GetSearchQuestionsSuccess,
    22   QuestionActionTypes,
    23   VoteAnswer,
    24   VoteAnswerSuccess
     21  QuestionActionTypes
    2522} from './question.actions';
    2623import { QuestionMapper } from './question.mapper';
     
    106103    );
    107104  });
    108 
    109   voteAnswer$ = createEffect(() => {
    110     return this.actions$.pipe(
    111       ofType<VoteAnswer>(QuestionActionTypes.VoteAnswer),
    112       mergeMap((action) => {
    113         const body = new VoteAnswerRequest(action.voteType);
    114         return this.api.post<VoteAnswerResponse>(`v1/questions/${action.questionUid}/answers/${action.answerUid}/votes`, body).pipe(
    115           switchMap((state) => [new VoteAnswerSuccess(QuestionMapper.ToVoteAnswerViewModel(state)), new EffectFinishedWorking()]),
    116           catchError((err) => [new EffectFinishedWorkingError(err)])
    117         );
    118       })
    119     );
    120   });
    121105}
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.mapper.ts

    r728eb31 r806f4ee  
    1010  QuestionStateViewModel,
    1111  StudentQuestionStateViewModel,
    12   TeamQuestionStateViewModel,
    13   VoteAnswerViewModel
     12  TeamQuestionStateViewModel
    1413} from 'src/app/shared-app/models';
    1514import { TranslateFromJsonService } from 'src/app/shared-app/services';
    16 import { PreviewQuestionResponse, QuestionStateResponse, VoteAnswerResponse } from './question-state-response.models';
     15import { PreviewQuestionResponse, QuestionStateResponse } from './question-state.models';
    1716
    1817export class QuestionMapper {
     
    5251          x.correctAnswer,
    5352          moment(x.createdOn),
    54           x.votesCount,
     53          x.upvotesCount,
    5554          answerStudent,
    5655          answerResponses
     
    114113    return questions;
    115114  }
    116 
    117   public static ToVoteAnswerViewModel(response: VoteAnswerResponse): VoteAnswerViewModel {
    118     return new VoteAnswerViewModel(response.answerUid, response.voteUid, response.voteType);
    119   }
    120115}
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.reducers.ts

    r728eb31 r806f4ee  
    1 import { VoteType } from 'src/app/shared-app/models';
    21import { QuestionAction, QuestionActionTypes } from './question.actions';
    32import { initialState, QuestionState } from './question.state';
     
    2625        searchQuestionsQuery: action.query
    2726      };
    28     case QuestionActionTypes.VoteAnswerSuccess: {
    29       if (state.question) {
    30         return {
    31           ...state,
    32           question: {
    33             ...state.question,
    34             answers: state.question.answers.map((x) => {
    35               if (x.uid === action.payload.answerUid) {
    36                 let votesCountNew = x.votesCount;
    37 
    38                 switch (action.payload.voteType) {
    39                   case VoteType.Upvote:
    40                     votesCountNew++;
    41                     break;
    42                   case VoteType.Downvote:
    43                     votesCountNew--;
    44                     break;
    45                 }
    46 
    47                 return {
    48                   ...x,
    49                   votesCount: votesCountNew
    50                 };
    51               }
    52 
    53               return x;
    54             })
    55           }
    56         };
    57       }
    58 
    59       return {
    60         ...state
    61       };
    62     }
    6327    case QuestionActionTypes.EffectStartedWorking: {
    6428      return {
  • src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/vote/vote.component.ts

    r728eb31 r806f4ee  
    11import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
    2 import { VoteType } from 'src/app/shared-app/models';
    32import { ButtonType } from '../button/button.models';
     3
     4export enum VoteType {
     5  Upvote,
     6  Downvote
     7}
    48
    59@Component({
  • src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/question-preview/question-preview.component.html

    r728eb31 r806f4ee  
    1414      <mat-card-content>
    1515        <div fxLayout="row wrap" fxLayoutAlign="space-around none">
    16           <app-vote
    17             [voteCount]="answer.votesCount"
    18             [correct]="answer.correctAnswer"
    19             (voteClicked)="answerVoted($event, answer.uid, question.uid)"
    20             fxFlex="6%"
    21           ></app-vote>
     16          <app-vote [voteCount]="answer.upvotesCount" [correct]="answer.correctAnswer" fxFlex="6%"></app-vote>
    2217          <div fxFlex="92%">
    2318            <app-text-editor
  • src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/question-preview/question-preview.component.ts

    r728eb31 r806f4ee  
    1 import { HttpErrorResponse } from '@angular/common/http';
    21import { Component, OnInit } from '@angular/core';
    3 import { NotificationService } from 'src/app/core/services/notification.service';
    42import { QuestionFacadeService } from 'src/app/core/state/question-facade.service';
    53
    6 import { QuestionStateViewModel, VoteType } from 'src/app/shared-app/models';
     4import { QuestionStateViewModel } from 'src/app/shared-app/models';
    75import { ButtonType } from '../../generic/button/button.models';
    86
     
    1614  working = true;
    1715  ButtonType = ButtonType;
    18   constructor(private questionFacade: QuestionFacadeService, private notification: NotificationService) {}
     16  constructor(private questionFacade: QuestionFacadeService) {}
    1917
    2018  ngOnInit(): void {
     
    2321      this.working = false;
    2422    });
    25 
    26     this.questionFacade.effectWorking$.subscribe((effect) => {
    27       if (effect instanceof HttpErrorResponse) {
    28         this.notification.handleErrorsNotification(effect.error);
    29       }
    30     });
    31   }
    32 
    33   answerVoted(voteType: VoteType, answerUid: string, questionUid: string): void {
    34     this.questionFacade.voteAnswer(answerUid, questionUid, voteType);
    3523  }
    3624}
  • src/Clients/Angular/finki-chattery/src/app/shared-app/models/question-state-enums.models.ts

    r728eb31 r806f4ee  
    33  Popular
    44}
    5 
    6 export enum VoteType {
    7   Upvote,
    8   Downvote
    9 }
  • src/Clients/Angular/finki-chattery/src/app/shared-app/models/question-state-view-models.models.ts

    r728eb31 r806f4ee  
    1 import { VoteType } from '.';
    2 
    31export class QuestionStateViewModel {
    42  constructor(
     
    3432    public correctAnswer: boolean,
    3533    public createdOn: moment.Moment,
    36     public votesCount: number,
     34    public upvotesCount: number,
    3735    public student: AnswerStudentQuestionStateViewModel,
    3836    public answerResponses: AnswerResponseQuestionStateViewModel[]
     
    7573  constructor(public text: string) {}
    7674}
    77 
    78 export class VoteAnswerViewModel {
    79   constructor(public answerUid: string, public voteUid: string, public voteType: VoteType) {}
    80 }
  • src/Clients/Angular/finki-chattery/src/assets/translations/en.json

    r728eb31 r806f4ee  
    5353  "ask-question-stepper-ask": "Ask question",
    5454  "ask-question-ask-button-back": "Edit question",
    55   "ask-question-ask-button": "Ask question",
    56   "AnswerAlreadyUpvoted": "You have already upvoted this answer",
    57   "AnswerAlreadyDownvoted": "You have already downvoted this answer",
    58   "StudentHasBadReputation": "You have bad reputation and can not vote"
     55  "ask-question-ask-button": "Ask question"
    5956}
  • src/FinkiChattery/FinkiChattery.Api/ApplicationServices/Questioning/Mapper/QuestionMapper.cs

    r728eb31 r806f4ee  
    5454                    var answerStudent = new AnswerStudentQuestionStateResponse(x.StudentDto.Id, x.StudentDto.Uid, x.StudentDto.Index, x.StudentDto.ImageUrl, x.StudentDto.Reputation);
    5555
    56                     return new AnswerQuestionStateResponse(x.Id, x.Uid, x.Text, x.CorrectAnswer, x.CreatedOn, x.VotesCount, answerStudent, answerResponses);
     56                    return new AnswerQuestionStateResponse(x.Id, x.Uid, x.Text, x.CorrectAnswer, x.CreatedOn, x.UpvotesCount, answerStudent, answerResponses);
    5757                });
    5858            }
  • src/FinkiChattery/FinkiChattery.Api/Services/RegisterServices.cs

    r728eb31 r806f4ee  
    11using FinkiChattery.Api.ApplicationServices.Authentication;
    2 using FinkiChattery.Api.ApplicationServices.Questioning.EventHandlers;
    32using FinkiChattery.Api.Services;
    43using FinkiChattery.Commands.Questioning;
     
    3231            services.AddScoped<IEventService, EventService>();
    3332            services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
    34             services.AddMediatR(typeof(AskQuestionCommand), typeof(GetQuestionStateQuery), typeof(UpdateAnswerVotesEventHandler));
     33            services.AddMediatR(typeof(AskQuestionCommand), typeof(GetQuestionStateQuery));
    3534        }
    3635
     
    5554            });
    5655            services.AddHangfireServer();
    57 
    58             services.AddScoped<IBackgroundJobClient>(provider =>
    59             {
    60                 return new BackgroundJobClient(JobStorage.Current);
    61             });
    6256        }
    6357
  • src/FinkiChattery/FinkiChattery.Commands/Questioning/QuestioningErrorCodes.cs

    r728eb31 r806f4ee  
    99        public const string CategoriesDontExist = "CategoriesDontExist";
    1010        public const string TeamDontExist = "TeamDontExist";
    11         public const string AnswerAlreadyUpvoted = "AnswerAlreadyUpvoted";
    12         public const string AnswerAlreadyDownvoted = "AnswerAlreadyDownvoted";
    13         public const string StudentHasBadReputation = "StudentHasBadReputation";
    1411    }
    1512}
  • src/FinkiChattery/FinkiChattery.Commands/Questioning/Validators/CategoriesUidsExist.cs

    r728eb31 r806f4ee  
    1 using FinkiChattery.Persistence.UnitOfWork;
     1using FinkiChattery.Persistence.Repositories;
     2using FinkiChattery.Persistence.UnitOfWork;
    23using FluentValidation.Validators;
    34using System;
  • src/FinkiChattery/FinkiChattery.Contracts/Questioning/GetQuestionState/QuestionStateResponse.cs

    r728eb31 r806f4ee  
    8989    public class AnswerQuestionStateResponse
    9090    {
    91         public AnswerQuestionStateResponse(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long votesCount, AnswerStudentQuestionStateResponse studentResponse, IEnumerable<AnswerResponseQuestionStateResponse> answerResponsesResponse)
     91        public AnswerQuestionStateResponse(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long upvotesCount, AnswerStudentQuestionStateResponse studentResponse, IEnumerable<AnswerResponseQuestionStateResponse> answerResponsesResponse)
    9292        {
    9393            Id = id;
     
    9696            CorrectAnswer = correctAnswer;
    9797            CreatedOn = createdOn;
    98             VotesCount = votesCount;
     98            UpvotesCount = upvotesCount;
    9999            StudentResponse = studentResponse;
    100100            AnswerResponsesResponse = answerResponsesResponse;
     
    107107        public bool CorrectAnswer { get; }
    108108        public DateTime CreatedOn { get; }
    109         public long VotesCount { get; }
     109        public long UpvotesCount { get; }
    110110        public AnswerStudentQuestionStateResponse StudentResponse { get; }
    111111        public IEnumerable<AnswerResponseQuestionStateResponse> AnswerResponsesResponse { get; }
  • src/FinkiChattery/FinkiChattery.Database/FinkiChattery.Database.sqlproj

    r728eb31 r806f4ee  
    7575    <Folder Include="dbo\Tables\QuestionCategory" />
    7676    <Folder Include="Snapshots" />
    77     <Folder Include="dbo\Tables\Vote" />
    7877  </ItemGroup>
    7978  <ItemGroup>
     
    8281    <Build Include="dbo\Tables\StudentTeam.sql" />
    8382    <Build Include="dbo\Tables\TeacherTeam.sql" />
     83    <Build Include="dbo\Tables\Upvote.sql" />
    8484    <Build Include="dbo\Tables\User\AspNetRoleClaims.sql" />
    8585    <Build Include="dbo\Tables\User\AspNetRoles.sql" />
     
    100100    <Build Include="dbo\Tables\QuestionCategory\QuestionCategory.sql" />
    101101    <None Include="dbo\Tables\QuestionCategory\QuestionCategory.Debug.Seed.sql" />
    102     <Build Include="dbo\Tables\Vote\Vote.sql" />
    103102  </ItemGroup>
    104103  <ItemGroup>
  • src/FinkiChattery/FinkiChattery.Database/dbo/Tables/Answer/Answer.Debug.Seed.sql

    r728eb31 r806f4ee  
    1212            (3, N'cee193c3-9d36-4ed8-81b2-15eb4ff305f1', N'Answer 3', 2, 1, 1, GETUTCDATE(), 5),
    1313            (4, N'dee193c3-9d36-4ed8-81b2-15eb4ff305f1', N'Answer 4', 2, 1, 0, GETUTCDATE(), 5)
    14     ) AS temp ([Id], [Uid], [Text], [QuestionFk], [StudentFk], [CorrectAnswer], [CreatedOn], [VotesCount])
     14    ) AS temp ([Id], [Uid], [Text], [QuestionFk], [StudentFk], [CorrectAnswer], [CreatedOn], [UpvotesCount])
    1515    ) AS S
    1616    ON T.[ID] = S.[ID]
     
    2121                   T.[StudentFk] = S.[StudentFk],
    2222                   T.[CorrectAnswer] = S.[CorrectAnswer],
    23                    T.[VotesCount] = S.[VotesCount]
     23                   T.[UpvotesCount] = S.[UpvotesCount]
    2424    WHEN NOT MATCHED THEN
    2525        INSERT
     
    3232            [CorrectAnswer],
    3333            [CreatedOn],
    34             [VotesCount]
     34            [UpvotesCount]
    3535        )
    3636        VALUES
    37         (S.[Id], S.[Uid], S.[Text], S.[QuestionFk], S.[StudentFk], S.[CorrectAnswer], S.[CreatedOn], S.[VotesCount]);
     37        (S.[Id], S.[Uid], S.[Text], S.[QuestionFk], S.[StudentFk], S.[CorrectAnswer], S.[CreatedOn], S.[UpvotesCount]);
    3838    SET IDENTITY_INSERT [dbo].[Answer] OFF
    3939END
  • src/FinkiChattery/FinkiChattery.Database/dbo/Tables/Answer/Answer.sql

    r728eb31 r806f4ee  
    77    [CorrectAnswer] BIT              NOT NULL,
    88    [CreatedOn]     SMALLDATETIME    NOT NULL,
    9     [VotesCount] BIGINT NOT NULL DEFAULT 0,
     9    [UpvotesCount] BIGINT NOT NULL DEFAULT 0,
    1010    CONSTRAINT [PK_Answer] PRIMARY KEY CLUSTERED ([Id] ASC),
    1111    CONSTRAINT [FK_Answer_Question_QuestionFk] FOREIGN KEY ([QuestionFk]) REFERENCES [dbo].[Question] ([Id]),
  • src/FinkiChattery/FinkiChattery.Persistence/Configurations/AnswerConfig.cs

    r728eb31 r806f4ee  
    2222            builder.Property(x => x.CorrectAnswer).HasColumnName(@"CorrectAnswer").HasColumnType("bit").IsRequired();
    2323            builder.Property(x => x.CreatedOn).HasColumnName(@"CreatedOn").HasColumnType("smalldatetime").IsRequired();
    24             builder.Property(x => x.VotesCount).HasColumnName(@"VotesCount").HasColumnType("bigint").IsRequired().HasDefaultValue(0);
     24            builder.Property(x => x.UpvotesCount).HasColumnName(@"UpvotesCount").HasColumnType("bigint").IsRequired().HasDefaultValue(0);
    2525
    2626            builder.HasOne(x => x.Question).WithMany(x => x.Answers).HasForeignKey(x => x.QuestionFk).OnDelete(DeleteBehavior.Restrict);
  • src/FinkiChattery/FinkiChattery.Persistence/Context/ApplicationDbContext.cs

    r728eb31 r806f4ee  
    2323        public DbSet<TeacherTeam> TeacherTeams { get; set; }
    2424        public DbSet<Team> Teams { get; set; }
    25         public DbSet<Vote> Votes { get; set; }
     25        public DbSet<Upvote> Upvotes { get; set; }
    2626
    2727        protected override void OnModelCreating(ModelBuilder builder)
     
    4242            builder.ApplyConfiguration(new TeacherTeamConfig(schema));
    4343            builder.ApplyConfiguration(new TeamConfig(schema));
    44             builder.ApplyConfiguration(new VoteConfig(schema));
     44            builder.ApplyConfiguration(new UpvoteConfig(schema));
    4545        }
    4646    }
  • src/FinkiChattery/FinkiChattery.Persistence/Models/Answer.cs

    r728eb31 r806f4ee  
    2020        public DateTime CreatedOn { get; set; }
    2121
    22         public long VotesCount { get; set; }
     22        public long UpvotesCount { get; set; }
    2323
    24         public virtual ICollection<Vote> Votes { get; set; }
     24        public virtual ICollection<Upvote> Upvotes { get; set; }
    2525
    2626        public virtual ICollection<AnswerResponse> AnswerResponses { get; set; }
  • src/FinkiChattery/FinkiChattery.Persistence/Models/Student.cs

    r728eb31 r806f4ee  
    1 using System.Collections.Generic;
     1using System;
     2using System.Collections.Generic;
     3using System.Linq;
     4using System.Text;
     5using System.Threading.Tasks;
    26
    37namespace FinkiChattery.Persistence.Models
     
    1822
    1923        public virtual ICollection<Question> Questions { get; set; }
    20 
     24       
    2125        public virtual ICollection<Answer> Answers { get; set; }
    22 
     26       
    2327        public virtual ICollection<StudentTeam> StudentTeams { get; set; }
    2428    }
  • src/FinkiChattery/FinkiChattery.Persistence/Repositories/Contracts/Question/QuestionStateDto.cs

    r728eb31 r806f4ee  
    8484    public class AnswerQuestionStateDto
    8585    {
    86         public AnswerQuestionStateDto(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long votesCount, AnswerStudentQuestionStateDto studentDto, IEnumerable<AnswerResponseQuestionStateDto> answerResponsesDto)
     86        public AnswerQuestionStateDto(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long upvotesCount, AnswerStudentQuestionStateDto studentDto, IEnumerable<AnswerResponseQuestionStateDto> answerResponsesDto)
    8787        {
    8888            Id = id;
     
    9191            CorrectAnswer = correctAnswer;
    9292            CreatedOn = createdOn;
    93             VotesCount = votesCount;
     93            UpvotesCount = upvotesCount;
    9494            StudentDto = studentDto;
    9595            AnswerResponsesDto = answerResponsesDto;
     
    101101        public bool CorrectAnswer { get; }
    102102        public DateTime CreatedOn { get; }
    103         public long VotesCount { get; }
     103        public long UpvotesCount { get; }
    104104        public AnswerStudentQuestionStateDto StudentDto { get; }
    105105        public IEnumerable<AnswerResponseQuestionStateDto> AnswerResponsesDto { get; }
  • src/FinkiChattery/FinkiChattery.Persistence/Repositories/Implementations/QuestionRepo.cs

    r728eb31 r806f4ee  
    8080                                                    y.CorrectAnswer,
    8181                                                    y.CreatedOn,
    82                                                     y.VotesCount,
     82                                                    y.UpvotesCount,
    8383                                                    new AnswerStudentQuestionStateDto(
    8484                                                        y.Student.Id,
  • src/FinkiChattery/FinkiChattery.Persistence/UnitOfWork/Contracts/IUnitOfWork.cs

    r728eb31 r806f4ee  
    1111        IStudentRepo Students { get; }
    1212        ITeamRepo Teams { get; }
    13         IVoteRepo Votes { get; }
    14         IAnswerRepo Answers { get; }
    1513        Task<int> SaveAsync();
    1614    }
  • src/FinkiChattery/FinkiChattery.Persistence/UnitOfWork/Implementations/UnitOfWork.cs

    r728eb31 r806f4ee  
    1212        private StudentRepo _students;
    1313        private TeamRepo _teams;
    14         private VoteRepo _votes;
    15         private AnswerRepo _answers;
    1614
    1715        public UnitOfWork(ApplicationDbContext dbContext)
     
    7270        }
    7371
    74         public IVoteRepo Votes
    75         {
    76             get
    77             {
    78                 if (_votes == null)
    79                 {
    80                     _votes = new VoteRepo(DbContext);
    81                 }
    82 
    83                 return _votes;
    84             }
    85         }
    86 
    87         public IAnswerRepo Answers
    88         {
    89             get
    90             {
    91                 if (_answers == null)
    92                 {
    93                     _answers = new AnswerRepo(DbContext);
    94                 }
    95 
    96                 return _answers;
    97             }
    98         }
    99 
    10072        public ApplicationDbContext DbContext { get; }
    10173
Note: See TracChangeset for help on using the changeset viewer.