Beispiel #1
0
        /// <summary>
        /// To the domain object.
        /// </summary>
        /// <param name="lesson1">The lesson1.</param>
        /// <returns></returns>
        public static Lesson1 ToDomainObject(this Lesson1Contract lesson1)
        {
            var expenses = new List <Expense>();
            var incomes  = new List <Income>();

            if (lesson1.Expenses != null)
            {
                expenses = lesson1.Expenses.Select(expense => expense.ToDomainObject()).ToList();
            }

            if (lesson1.Incomes != null)
            {
                incomes = lesson1.Incomes.Select(income => income.ToDomainObject()).ToList();
            }

            var membershipApi      = new AsaMemberAdapter();
            var activeDirectoryKey = membershipApi.GetActiveDirectoryKeyFromContext();

            return(new Lesson1()
            {
                Expenses = expenses,
                Incomes = incomes,
                Goal = lesson1.Goal != null?lesson1.Goal.ToDomainObject() : new Goal(),
                           User = lesson1.User.ToDomainObject(),
                           IndividualId = !string.IsNullOrWhiteSpace(activeDirectoryKey)
                                        ? new Guid(activeDirectoryKey)
                                        : Guid.Empty
            });
        }
Beispiel #2
0
 /// <summary>
 /// Posts the users lesson1 responses.
 /// </summary>
 /// <param name="lesson">The lesson.</param>
 /// <returns>Lesson1Contract</returns>
 public static Lesson1Contract PostLesson1(Lesson1Contract lesson)
 {
     using (var client = new SaltServiceProxy())
     {
         var toReturn = client.Execute(proxy => proxy.PostLesson1(lesson));
         return(toReturn.UpdateStatus == LessonUpdateStatus.Success ? toReturn.Lesson : null);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Posts the users lesson 1 data.
 /// </summary>
 /// <param name="lesson">The lesson.</param>
 /// <returns></returns>
 public PostLessonResultContract <Lesson1Contract> PostLesson1(Lesson1Contract lesson)
 {
     return(_lessonsService.Resolve().PostLesson1(lesson.ToDomainObject <Lesson1Contract, Lesson1>()).ToDataContract <PostLessonResult <Lesson1>, PostLessonResultContract <Lesson1Contract> >());
 }