public ActionResult Create(aloSorteoInput input) { if (!ModelState.IsValid) return PartialView(input); var entity = new aloSorteos { detalle = input.detalle, fecha = input.fecha, fechaPago = input.fechaPago, estadia_desde = input.estadia_desde, estadia_hasta = input.estadia_hasta, inscripcion_desde = input.inscripcion_desde, inscripcion_hasta = input.inscripcion_hasta, tipo_Id = input.tipo, }; UnitOfWork.AloSorteoRepository.Insert(entity); UnitOfWork.Save(); return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow }
public ActionResult Edit(aloSorteoInput input) { if (!ModelState.IsValid) return PartialView("Create", input); var entity = UnitOfWork.AloSorteoRepository.GetById(input.Id); entity.detalle = input.detalle; entity.fecha = input.fecha; entity.fechaPago = input.fechaPago; entity.estadia_desde = input.estadia_desde; entity.estadia_hasta = input.estadia_hasta; entity.inscripcion_desde = input.inscripcion_desde; entity.inscripcion_hasta = input.inscripcion_hasta; entity.tipo_Id = input.tipo; UnitOfWork.AloSorteoRepository.Update(entity); UnitOfWork.Save(); //t.InjectFrom(entity); // returning the key to call grid.api.update return Json(new { input.Id }); }
public ActionResult Edit(int id, bool hide_tipo = false) { var entity = UnitOfWork.AloSorteoRepository.GetById(id); var input = new aloSorteoInput { Id = entity.Id, detalle = entity.detalle, fecha = entity.fecha, fechaPago = entity.fechaPago, estadia_desde = entity.estadia_desde, estadia_hasta = entity.estadia_hasta, inscripcion_desde = entity.inscripcion_desde, inscripcion_hasta = entity.inscripcion_hasta, tipo = entity.aloTipos.Id, hide_tipo=hide_tipo, }; return PartialView("Create", input); }