public ActionResult Create(CampamentoViewModel collection)
        {
            /*foreach (SelectListItem bano in collection.TipoBanos)
            {
                if (bano.Selected)
                {
                    collection.tipoBano += bano.Value;
                }
            }*/

            try
            {
                var campamento = new compound() {
                    bedrooms = collection.Habitaciones,
                    capacity = collection.Capacidad,
                    cellphone_signal = Convert.ToInt16(collection.SenalCelular),
                    disable = Convert.ToInt16(false),
                    drinkable_water = Convert.ToInt16(collection.AguaPotable),
                    electricity = Convert.ToInt16(collection.Electricidad),
                    location = collection.Provincia,
                    name = collection.Nombre,
                    toilet_quantity = collection.CantidadBanos,
                    toilet_type = collection.tipoBano.ToString(),
                    town = collection.Comunidad,
                    ventilation = collection.Ventilacion,
                    wifi = Convert.ToInt16(collection.Wifi)
                };

                logistica.compound.Add(campamento);

                logistica.SaveChanges();
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #2
0
 : dateRule is DateCompoundRule compound?nameof(Type).WriteValueProperty(nameof(DateCompoundRule)).Then(nameof(DateRule).WriteObjectProperty(compound, WriteDateCompoundRule))(writer)