Ejemplo n.º 1
0
        public ActionResult Create(genActividadeInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var entity = new genActividades
            {
                desc = input.desc,
                detalle = input.detalle,
                idSede = input.idSede,
                lugar = input.lugar,
                fecha = input.fecha,
                refCosto = input.refCosto,
                foto = input.foto,
                tel = input.tel,
                mail = input.mail,
                ventaTickets = true, // Only records where "ventaTickets"=1 
                ventaDesde = input.ventaDesde,
                ventaHasta = input.ventaHasta,
                blogPost = input.blogPost,
            };

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

            return Json(MapToGridModel(entity)); // returning grid model, used in grid.api.renderRow
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var entity = UnitOfWork.GenActividadeRepository.GetById(id);

            var input = new genActividadeInput
            {
                id = entity.id,
                desc = entity.desc,
                detalle = entity.detalle,
                idSede = entity.idSede,
                lugar = entity.lugar,
                fecha = entity.fecha,
                refCosto = entity.refCosto,
                foto = entity.foto,
                tel = entity.tel,
                mail = entity.mail,
                ventaDesde = entity.ventaDesde,
                ventaHasta = entity.ventaHasta,
                blogPost = entity.blogPost,
            };

            return PartialView("Create", input);
        }
Ejemplo n.º 3
0
        public ActionResult Edit(genActividadeInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var entity = UnitOfWork.GenActividadeRepository.GetById(input.id);

            entity.desc = input.desc;
            entity.detalle = input.detalle;
            entity.idSede = input.idSede;
            entity.lugar = input.lugar;
            entity.fecha = input.fecha;
            entity.refCosto = input.refCosto;
            entity.foto = input.foto;
            entity.tel = input.tel;
            entity.mail = input.mail;
            entity.ventaDesde = input.ventaDesde;
            entity.ventaHasta = input.ventaHasta;
            entity.blogPost = input.blogPost;

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

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