예제 #1
0
        private async Task <Evento> CreateEvento(EventoRequest request, Operacao operacao)
        {
            int EventoId = await _eventoService.MaxByOperacao(operacao.Id) + 100;

            var entity = new Evento()
            {
                Id         = EventoId,
                Nome       = request.Nome,
                Descricao  = request.Descricao,
                Data       = request.Data,
                Local      = request.Local,
                TipoEvento = request.TipoEventoId,
            };

            await _eventoService.Create(entity);

            return(entity);
        }
예제 #2
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                Evento evento = new Evento();
                evento.AreaId   = pAreaId;
                evento.EventoId = (decimal)(UniqueKeyGenerator.GetInstance().GetUniqueKey());
                try { evento.Fecha = DateTime.Parse(collection["Fecha"].ToString()); }
                catch (Exception ex) { }

                try { evento.Duracion = TimeSpan.Parse(collection["Duracion"].ToString());; }
                catch (Exception ex) { }
                evento.NumeroParticipantes = Decimal.Parse(collection["NumeroParticipantes"]);
                evento.NumeroComisarios    = Decimal.Parse(collection["NumeroComisarios"]);
                evento.DeporteId           = Decimal.Parse(collection["DeporteId"]);
                _eventoService.Create(evento);
                return(RedirectToAction("Index", new { areaId = pAreaId }));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }