public AllData GetEvent(int eventId)
        {
            var _event = FakeRepository.Get.Events.SingleOrDefault(e => e.Id.Equals(eventId));

            if (_event != null)
            {
                return(FakeConverters.EventToAllDataConverter(_event));
            }

            return(null);
        }
示例#2
0
        public int CreateEvent(Event _event)
        {
            var fakeCalendar = FakeRepository.Get.Calendars.SingleOrDefault(c => c.Id.Equals(_event.CalendarId));

            if (fakeCalendar != null)
            {
                _event.Id = ++eventId;
                var fakeEvent = FakeConverters.EventToFakeEvent(_event, fakeCalendar);
                FakeRepository.Get.Events.Add(fakeEvent);
                fakeCalendar.Events.Add(fakeEvent);
                return(fakeEvent.Id);
            }
            return(-1);
        }
        public int CreateCalendar(int userId, Calendar calendar)
        {
            var fakeUser = FakeRepository.Get.Users.SingleOrDefault(u => u.Id.Equals(userId));

            if (fakeUser != null)
            {
                calendar.Id = ++fakeCalendarId;
                var fakeCalendar = FakeConverters.CalendarToFakeCalendar(calendar, fakeUser);
                fakeCalendar.Users.Add(fakeUser);
                FakeRepository.Get.Calendars.Add(fakeCalendar);
                fakeUser.Calendars.Add(fakeCalendar);
                return(fakeCalendar.Id);
            }

            return(-1);
        }
示例#4
0
        public void CreateUser(User user)
        {
            user.IdUser = ++fakeUserId;
            var fUser = FakeConverters.UserToFakeUser(user);

            FakeRepository.Get.Users.Add(fUser);
            var cRepos     = new FakeCalendarRepository();
            var calendarId = cRepos.CreateCalendar(fUser.Id, new Calendar
            {
                AccessId    = (int)Business.Models.Access.Private,
                Name        = "Default",
                UserOwnerId = fUser.Id,
                ColorId     = ColorFake.Default.Id,
                ColorHex    = ColorFake.Default.Hex,
            });
            var calendar = FakeRepository.Get.Calendars.SingleOrDefault(c => c.Id.Equals(calendarId));

            fUser.DefaultCalendar = calendar;
        }
示例#5
0
        public User GetUserByIdentityId(string id)
        {
            var user = FakeRepository.Get.Users.SingleOrDefault(u => u.IdentityId.Equals(id, StringComparison.OrdinalIgnoreCase));

            return(FakeConverters.FakeUserToUser(user));
        }
示例#6
0
        public User GetUserByEmail(string email)
        {
            var user = FakeRepository.Get.Users.SingleOrDefault(u => u.Email.Equals(email, StringComparison.OrdinalIgnoreCase));

            return(FakeConverters.FakeUserToUser(user));
        }
示例#7
0
        public IEnumerable <Browser> GetBrowsers(int calendarId)
        {
            var calendar = FakeRepository.Get.Calendars.SingleOrDefault(c => c.Id.Equals(calendarId));

            return(calendar.Users.SelectMany(u => u.Browsers.Select(b => FakeConverters.FakeBrowserToBrowser(b))));
        }
        public Calendar GetCalendarById(int calendarId)
        {
            var fakeCalendar = GetFakeCalendarById(calendarId);

            return(FakeConverters.FakeCalendarToCalendar(fakeCalendar));
        }