From 4159cb31034cb5d6b6d74d382b1cf7cabd20efb6 Mon Sep 17 00:00:00 2001
From: MaxchilKH <m.w.bohdanowicz@gmail.com>
Date: Fri, 6 Nov 2020 21:28:58 +0100
Subject: [PATCH] fix internship registration

---
 .../UpdateInternshipRegistrationUseCase.cs    |  4 +-
 .../DatabaseFiller.cs                         | 60 ++++++++++++++++++-
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/src/InternshipSystem.Api/UseCases/UpdateInternshipRegistrationUseCase.cs b/src/InternshipSystem.Api/UseCases/UpdateInternshipRegistrationUseCase.cs
index 726ec00..b196099 100644
--- a/src/InternshipSystem.Api/UseCases/UpdateInternshipRegistrationUseCase.cs
+++ b/src/InternshipSystem.Api/UseCases/UpdateInternshipRegistrationUseCase.cs
@@ -144,7 +144,9 @@ namespace InternshipSystem.Api.UseCases
 
         private void UpdateMentor(UpdateMentor mentorUpdate)
         {
-            subjectRegistration.Mentor.UpdateInformation(mentorUpdate.FirstName, mentorUpdate.LastName, mentorUpdate.Email, mentorUpdate.PhoneNumber);
+            var mentor = subjectRegistration.Mentor ?? new Mentor();
+            
+            mentor.UpdateInformation(mentorUpdate.FirstName, mentorUpdate.LastName, mentorUpdate.Email, mentorUpdate.PhoneNumber);
         }
     }
 }
\ No newline at end of file
diff --git a/src/InternshipSystem.Repository/DatabaseFiller.cs b/src/InternshipSystem.Repository/DatabaseFiller.cs
index 6ce607c..1bcdedc 100644
--- a/src/InternshipSystem.Repository/DatabaseFiller.cs
+++ b/src/InternshipSystem.Repository/DatabaseFiller.cs
@@ -215,7 +215,65 @@ namespace InternshipSystem.Repository
                         }
                     },
                     Internships = new List<Internship>(),
-                }
+                },
+                new Edition
+                {
+                    Id = Guid.Parse("bd0da085-8e51-400d-9630-bdab3f9f6cc8"),
+                    EditionStart = new DateTime(2019, 5, 10),
+                    EditionFinish = new DateTime(2019, 12, 10),
+                    ReportingStart = new DateTime(2019, 9, 30),
+                    AvailableSubjects = new List<EditionSubject>
+                    {
+                        new EditionSubject
+                        {
+                            Subject = new InternshipSubject
+                            {
+                                Description = "Modelowanie baz danych",
+                                DescriptionEng = "Database modeling",
+                            }
+                        },
+                        new EditionSubject
+                        {
+                            Subject = new InternshipSubject 
+                            {
+                                Description = "Oprogramowywanie kart graficznych",
+                                DescriptionEng = "Graphics card software",
+                            }
+                        },
+                        new EditionSubject
+                        {
+                            Subject = new InternshipSubject
+                            {
+                                Description = "Projektowanie UI",
+                                DescriptionEng = "UI design",
+                            }
+                        }
+                    },
+                    Course = new Course
+                    {
+                        Name = "Inżynieria Biomedyczna",
+                    },
+                    AvailableInternshipTypes = new List<EditionInternshipType>
+                    {
+                        new EditionInternshipType
+                        {
+                            InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o pracę"))
+                        },
+                        new EditionInternshipType
+                        {
+                            InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa zlecenie"))
+                        },
+                        new EditionInternshipType
+                        {
+                            InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Umowa o dzieło"))
+                        },
+                        new EditionInternshipType
+                        {
+                            InternshipType = Context.InternshipTypes.First(t => t.Label.Equals("Praktyka bezpłatna"))
+                        }
+                    },
+                    Internships = new List<Internship>(),
+                    }
             };
             
             var edition = editions.First();
-- 
2.45.2