public async Task <ApiResponse <AddFechaCalendarioDTO> > addFecha(AddFechaCalendarioDTO fechaCalendario)
        {
            ApiResponse <AddFechaCalendarioDTO> response = new ApiResponse <AddFechaCalendarioDTO>();

            try
            {
                FechaCalendario fc = new FechaCalendario();
                fc.CalendarioId = fechaCalendario.CalendarioId;
                fc.Fecha        = fechaCalendario.Fecha;
                fc.Texto        = fechaCalendario.Texto;

                _context.FechaCalendarios.Add(fc);
                await _context.SaveChangesAsync();

                response.Data = fechaCalendario;
            }
            catch (Exception e)
            {
                response.Success = false;
                response.Status  = 500;
                response.Message = e.Message;
            }

            return(response);
        }
Exemple #2
0
 public IActionResult AddFechaCalendario([FromBody] AddFechaCalendarioDTO fc)
 {
     return(Ok(_cursoManager.addFecha(fc)));
 }