Example #1
0
        public ActionResult Create(aloZonaInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var entity = new aloZonas
            {
                Id = input.Id,
                desc1 = input.desc1,
                desc2 = input.desc2,
                personas = input.personas,
                croquis = input.croquis,
                precioTempAlta = input.precioAlta,
                precioTempBaja= input.precioBaja,
                tipo_Id = input.tipo??0,
            };

            UnitOfWork.AloZonaRepository.Insert(entity);
            UnitOfWork.Save();

            return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow
        }
Example #2
0
        public ActionResult Edit(string id)
        {
            var entity = UnitOfWork.AloZonaRepository.GetById(id);

            var input = new aloZonaInput
            {
                Id = entity.Id,
                desc1 = entity.desc1,
                desc2 = entity.desc2,
                personas = entity.personas,
                croquis = entity.croquis,
                precioAlta = entity.precioTempAlta??0,
                precioBaja = entity.precioTempBaja??0,
                tipo = entity.tipo_Id,
            };

            return PartialView("Create", input);
        }
Example #3
0
        public ActionResult Edit(aloZonaInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var entity = UnitOfWork.AloZonaRepository.GetById(input.Id);

            entity.desc1 = input.desc1;
            entity.desc2 = input.desc2;
            entity.personas = input.personas;
            entity.croquis = input.croquis;
            entity.precioTempAlta = input.precioAlta;
            entity.precioTempBaja = input.precioBaja;
            entity.tipo_Id = input.tipo??0;

            UnitOfWork.AloZonaRepository.Update(entity);
            UnitOfWork.Save();

            // returning the key to call grid.api.update
            return Json(new { input.Id });
        }