Example #1
0
        /// <summary>
        /// Transform a category database object to a Category view Obj
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public static ViewObj.Category TransformDbtoViewObj(DbObj.Category category)
        {
            ViewObj.Category newCategory = null;
            if (category != null)
            {
                newCategory = new ViewObj.Category
                {
                    CategoryId  = category.CategoryId,
                    Name        = category.Name,
                    Description = category.Description
                };
            }

            return(newCategory);
        }
Example #2
0
 /// <summary>
 /// Transform a category view object to a Category EF Obj
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public static DbObj.Category TransformViewToDbObj(ViewObj.Category category)
 {
     DbObj.Category newCategory = null;
     if (category != null)
     {
         newCategory = new DbObj.Category
         {
             CategoryId  = category.CategoryId,
             Name        = category.Name,
             Description = category.Description,
             UserEmail   = string.Empty      // Field that needs to be setup from outside the transformation
         };
     }
     return(newCategory);
 }