Esempio n. 1
0
        public Conference ConvertToConference(ConferenceModel conference)
        {
            Conference c = new Conference
            {
                ConferenceId = conference.ConferenceId,
                ProfileId = conference.ProfileId,
                Title = conference.Title,
                Content = conference.Content,
                Location = conference.Location,
                Date = conference.Date,
            };

            return c;
        }
Esempio n. 2
0
        public ConferenceModel ConvertToModel(Conference c)
        {
            ConferenceModel conference = new ConferenceModel
            {
                ConferenceId = c.ConferenceId,
                ProfileId = c.ProfileId,
                FirstName = c.Profile.FirstName,
                LastName = c.Profile.LastName,
                Title = c.Title,
                Content = c.Content,
                Location = c.Location,
                Date = c.Date.Value
            };

            return conference;
        }
        public void Update()
        {
            Conference result = new Conference();
            ConferenceModel updated;
            DateTime newDate = new DateTime(2016, 2, 2);

            ConferenceModel conference = new ConferenceModel
            {
                ProfileId = 1,
                Location = "TestLocation",
                Date = new DateTime(2016, 1, 1),
                Content = "TestContet",
                Title = "TestTitle"
            };

            result = repo.SearchConference(conference).FirstOrDefault();

            if(result != null)
            {
                result.Location = "UpdateLocation";
                result.Content = "UpdateContent";
                result.Title = "UpdateTitle";
                result.Date = newDate;

                updated = repo.ConvertToModel(result);

                repo.UpdateConference(updated);

                result = repo.SearchConference(updated).FirstOrDefault();

                Assert.IsTrue(result.Location == "UpdateLocation");
                Assert.IsTrue(result.Content == "UpdateContent");
                Assert.IsTrue(result.Title == "UpdateTitle");
                Assert.IsTrue(result.Date == newDate);
            }
        }