Beispiel #1
0
        public ActionResult Put(int id, [FromBody] InscriptionWindow inscriptionWindow)
        {
            try
            {
                var dbInscWindow = context.InscriptionWindow.SingleOrDefault(insc => insc.Id == inscriptionWindow.Id);

                if (dbInscWindow != null)
                {
                    dbInscWindow.StartDate = inscriptionWindow.StartDate.ToLocalTime();
                    dbInscWindow.EndDate   = inscriptionWindow.EndDate.ToLocalTime();

                    context.Entry(dbInscWindow).State = EntityState.Modified;
                    context.SaveChanges();
                    return(Ok($"Se actualizó la ventana de inscripción desde: {inscriptionWindow.StartDate.ToShortDateString()} hasta {inscriptionWindow.EndDate.ToShortDateString()}."));
                }
                else
                {
                    return(BadRequest($"No hay precargada una Ventana para el tipo: {id}"));
                }
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Beispiel #2
0
 public ActionResult Post([FromBody] InscriptionWindow inscriptionWindow)
 {
     try
     {
         inscriptionWindow.StartDate = inscriptionWindow.StartDate.ToLocalTime();
         inscriptionWindow.EndDate   = inscriptionWindow.EndDate.ToLocalTime();
         context.InscriptionWindow.Add(inscriptionWindow);
         context.SaveChanges();
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Beispiel #3
0
        private void CreateInscriptionWindow(object o)
        {
            InscriptionWindow Instance = new InscriptionWindow();

            Instance.ShowDialog();
        }