Example #1
0
        public void AddCriminal(AddCriminalViewModel addCriminalViewModel)
        {
            Criminal criminal = new Criminal();

            criminal.Name            = addCriminalViewModel.Name;
            criminal.Surname         = addCriminalViewModel.Surname;
            criminal.Nickname        = addCriminalViewModel.Nickname;
            criminal.Residence       = addCriminalViewModel.Residence;
            criminal.BirthPlace      = addCriminalViewModel.BirthPlace;
            criminal.BirthDate       = addCriminalViewModel.BirthDate;
            criminal.Wanted          = addCriminalViewModel.Wanted;
            criminal.CommittedCrimes = new List <CommittedCrime>();

            databaseCriminals.InsertOne(criminal);
        }
Example #2
0
        public void EditCriminal(EditCriminalViewModel editCriminalViewModel)
        {
            Criminal criminal = new Criminal();

            criminal._id             = editCriminalViewModel.Criminal._id;
            criminal.Name            = editCriminalViewModel.Name;
            criminal.Surname         = editCriminalViewModel.Surname;
            criminal.Nickname        = editCriminalViewModel.Nickname;
            criminal.Residence       = editCriminalViewModel.Residence;
            criminal.BirthPlace      = editCriminalViewModel.BirthPlace;
            criminal.BirthDate       = editCriminalViewModel.BirthDate;
            criminal.Wanted          = editCriminalViewModel.Wanted;
            criminal.CommittedCrimes = editCriminalViewModel.Criminal.CommittedCrimes;

            databaseCriminals.FindOneAndReplace(x => x._id == editCriminalViewModel.Criminal._id, criminal);
        }
Example #3
0
        public void AssignCrime(AssignCrimeViewModel assignCrimeViewModel)
        {
            Criminal       criminal       = assignCrimeViewModel.Criminal;
            CommittedCrime committedCrime = new CommittedCrime();

            committedCrime.Crime              = assignCrimeViewModel.Crime;
            committedCrime.Description        = assignCrimeViewModel.Description;
            committedCrime.ImprisonmentDate   = assignCrimeViewModel.ImprisonmentDate;
            committedCrime.ImprisonmentLength = assignCrimeViewModel.ImprisonmentLength;

            if (criminal.CommittedCrimes == null)
            {
                criminal.CommittedCrimes = new List <CommittedCrime>();
            }
            criminal.CommittedCrimes.Add(committedCrime);
            databaseCriminals.FindOneAndReplace(x => x._id == criminal._id, criminal);
        }
Example #4
0
        public void AddCriminalPhoto(AddCriminalPhotoViewModel addCriminalPhotoViewModel)
        {
            Criminal criminal = new Criminal();

            criminal._id             = addCriminalPhotoViewModel.Criminal._id;
            criminal.Name            = addCriminalPhotoViewModel.Criminal.Name;
            criminal.Surname         = addCriminalPhotoViewModel.Criminal.Surname;
            criminal.Nickname        = addCriminalPhotoViewModel.Criminal.Nickname;
            criminal.Residence       = addCriminalPhotoViewModel.Criminal.Residence;
            criminal.BirthPlace      = addCriminalPhotoViewModel.Criminal.BirthPlace;
            criminal.BirthDate       = addCriminalPhotoViewModel.Criminal.BirthDate;
            criminal.Wanted          = addCriminalPhotoViewModel.Criminal.Wanted;
            criminal.CommittedCrimes = addCriminalPhotoViewModel.Criminal.CommittedCrimes;
            criminal.Image           = addCriminalPhotoViewModel.Image;

            databaseCriminals.FindOneAndReplace(x => x._id == addCriminalPhotoViewModel.Criminal._id, criminal);
        }
Example #5
0
        public void UnassignCrime(UnassignCrimeViewModel unassignCrimeViewModel)
        {
            Criminal criminal = unassignCrimeViewModel.Criminal;

            databaseCriminals.FindOneAndReplace(x => x._id == criminal._id, criminal);
        }
Example #6
0
        public void DeleteCriminal(EditCriminalViewModel editCriminalViewModel)
        {
            Criminal criminal = editCriminalViewModel.Criminal;

            databaseCriminals.DeleteOne(x => x._id == criminal._id);
        }