Beispiel #1
0
        /// <summary>
        /// This is the constructor for the Height page
        /// </summary>
        /// <param name="data">A DataProvider object to read the data from</param>
        public Height(DataProvider data)
        {
            InitializeComponent();

            model = new HeightViewModel(data);

            this.DataContext = model;
        }
 public BindingHeight()
 {
     InitializeComponent();
     BindingContext = new HeightViewModel()
     {
         CustomHeight = 200,
         GridLength   = new GridLength(200.00)
     };
 }
        public void HeightViewModel_SliderValueChanged_ChangesToCorrectValues()
        {
            var data  = Factories.GetHeightData();
            var model = new HeightViewModel(data);

            model.slValueChanged(2);

            Assert.AreEqual(30f, model.HeightValL);
            Assert.AreEqual(0f, model.HeightValR);
            Assert.AreEqual("Height: 30 ft", model.HeightText);
        }
Beispiel #4
0
 public HttpResponseMessage Create(HttpRequestMessage request, HeightViewModel heightVm)
 {
     if (ModelState.IsValid)
     {
         var newHeight = new Height();
         newHeight.UpdateHeight(heightVm);
         try
         {
             _heightService.Add(newHeight);
             _heightService.Save();
             return(request.CreateResponse(HttpStatusCode.OK, heightVm));
         }
         catch (NameDuplicatedException dex)
         {
             return(request.CreateErrorResponse(HttpStatusCode.BadRequest, dex.Message));
         }
     }
     else
     {
         return(request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }
Beispiel #5
0
 public static void UpdateHeight(this Height height, HeightViewModel heightVm)
 {
     height.ID   = heightVm.ID;
     height.Name = heightVm.Name;
 }