Exemplo n.º 1
0
        public ComplexModelResponse PingComplexModel(ComplexInputModel inputModel)
        {
            //Console.WriteLine("Input data. IntProperty: {0}, StringProperty: {1}", inputModel.IntProperty, inputModel.StringProperty);

            return(new ComplexModelResponse
            {
                //FloatProperty = float.MaxValue / 2,
                StringProperty = inputModel.StringProperty,
                ListProperty = inputModel.ListProperty,
                DateTimeOffsetProperty = inputModel.DateTimeOffsetProperty
            });
        }
        public ActionResult SportComplexes_Update([DataSourceRequest]DataSourceRequest request, ComplexInputModel sportComplex)
        {
            if (ModelState.IsValid)
            {
                var entity = this.complexes.AllWithDeleted().Where(x => x.OwnerId == sportComplex.OwnerId).FirstOrDefault();
                entity.Name = sportComplex.Name;
                entity.Description = sportComplex.Description;
                entity.WorkHourFrom = sportComplex.WorkHourFrom;
                entity.WorkHourTo = sportComplex.WorkHourTo;
                entity.Address = sportComplex.Address;
                

                this.complexes.SaveChanges();
            }
            var complexToDisplay = this.complexes.AllWithDeleted()
                           .To<ComplexViewModel>()
                           .FirstOrDefault(x => x.OwnerId == sportComplex.OwnerId);

            return Json(new[] { complexToDisplay }.ToDataSourceResult(request, ModelState));
        }