public MeasureModel Create(Measure measure)
 {
   return new MeasureModel()
   {
     Description = measure.Description,
     Calories = Math.Round(measure.Calories)
   };
 }
Exemple #2
0
 public MeasureV2Model Create2(Measure measure)
 {
     return new MeasureV2Model()
     {
         Url = _urlHelper.Link("Measures", new { id = measure.Food.Id, measuresid = measure.Id }),
         Description = measure.Description,
         Calories = Math.Round(measure.Calories)
     };
 }
 public MeasureModel Create(Measure measure)
 {
     return new MeasureModel()
       {
     Links = new List<LinkModel>()
     {
       CreateLink(_urlHelper.Link("Measures", new { foodid = measure.Food.Id, id = measure.Id }), "self")
     },
     Description = measure.Description,
     Calories = Math.Round(measure.Calories)
       };
 }
 public MeasureModel Create(Measure m)
 {
     return new MeasureModel()
     {
         Links = new List<LinkModel>()
         {
             CreateLink(_urlHelp.Link("Measures", new {foodid = m.Food.Id, id = m.Id}), "POST")
         },
         Description = m.Description,
         Calories = m.Calories
     };
 }
		public MeasureV2Model Create2(Measure measure)
		{
			return new MeasureV2Model
			{
				Url = _urlHelper.Link("Measures2", new { foodid = measure.Food.Id, id = measure.Id }),
				Description = measure.Description,
				Calories = Math.Round(measure.Calories),
				Carbohydrates = measure.Carbohydrates,
				Cholestrol = measure.Cholestrol,
				Fiber = measure.Fiber,
				Iron = measure.Iron,
				Protein = measure.Protein,
				SaturatedFat = measure.SaturatedFat,
				Sodium = measure.Sodium,
				Sugar = measure.Sugar,
				TotalFat = measure.TotalFat
			};
		}
 public MeasureV2Model Create2(Measure measure)
 {
     return new MeasureV2Model()
     {
         Url = _urlHelper.Link("Measures", new { foodid = measure.Food.Id, id = measure.Id }),
         Description = measure.Description,
         Calories = Math.Round(measure.Calories),
         Carbohydrates=measure.Carbohydrates,
         Cholestrol=measure.Cholestrol,
         Fiber = measure.Fiber
         //... and so on for the rest in the model
     };
 }
 public MeasureV2eModel Create2(Measure m)
 {
     return new MeasureV2eModel
     {
         URL = _urlHelp.Link("Measures", new { foodid = m.Food.Id, id = m.Id }),
         Description = m.Description,
         Calories = m.Calories,
         Carbohydrates = m.Carbohydrates,
         Cholestrol = m.Cholestrol,
         Fiber = m.Fiber,
         Iron = m.Iron,
         Protein = m.Protein,
         SaturatedFat = m.SaturatedFat,
         Sodium = m.Sodium,
         Sugar = m.Sugar,
         TotalFat = m.TotalFat
     };
 }