Ejemplo n.º 1
0
        /// <summary>
        /// Converts a recipe entity into the display model sent
        /// to the view.
        /// </summary>
        /// <param name="entity">The entity to convert</param>
        /// <returns>A RecipeDisplayViewModel that represents the underlying domain entity</returns>
        private StyleDisplayViewModel ToDisplayModel(StyleEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(
                    "entity",
                    "Cannot convert an entity to a view model when no entity is passed.");
            }

            return new StyleDisplayViewModel
            {
                StyleId = entity.StyleId,
                Name = entity.Name,
                Slug = entity.Slug,
                Category = entity.Category.ToString()
            };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Assigns the values of a Style entity's 
 /// properties to the properties of a Style
 /// data model.
 /// </summary>
 /// <param name="style">The Style entity
 /// containing the property values to assign.
 /// </param>
 /// <param name="dbStyle">The Style data
 /// model to receive the property values.
 /// </param>
 private void AssignEntityToModel(StyleEntity style, Style dbStyle)
 {
     dbStyle.Name = style.Name;
     dbStyle.StyleId = style.StyleId;
     dbStyle.Category = ConvertToModel(style.Category);
     dbStyle.Slug = style.Slug;
 }
 public StyleDisplayViewModel EntityToViewModel(StyleEntity entity)
 {
     throw new NotImplementedException();
 }