Ejemplo n.º 1
0
        public IHttpActionResult PutYEAR(int id, YEAR yEAR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != yEAR.YEAR_ID)
            {
                return(BadRequest());
            }

            db.Entry(yEAR).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!YEARExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            YEAR yEAR = db.YEARS.Find(id);

            db.YEARS.Remove(yEAR);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public void DeactivateYear(int id)
 {
     using (SEDESOLEntities entities = new SEDESOLEntities())
     {
         YEAR year = entities.YEARs.Find(id);
         year.IsActive = false;
         entities.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "yearid,yearref")] YEAR yEAR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(yEAR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(yEAR));
 }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "yearid,yearref")] YEAR yEAR)
        {
            if (ModelState.IsValid)
            {
                db.YEARS.Add(yEAR);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(yEAR));
        }
Ejemplo n.º 6
0
        public IHttpActionResult GetYEAR(int id)
        {
            YEAR yEAR = db.YEARs.Find(id);

            if (yEAR == null)
            {
                return(NotFound());
            }

            return(Ok(yEAR));
        }
Ejemplo n.º 7
0
        public IHttpActionResult PostYEAR(YEAR yEAR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.YEARs.Add(yEAR);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = yEAR.YEAR_ID }, yEAR));
        }
Ejemplo n.º 8
0
        // GET: YEARs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            YEAR yEAR = db.YEARS.Find(id);

            if (yEAR == null)
            {
                return(HttpNotFound());
            }
            return(View(yEAR));
        }
Ejemplo n.º 9
0
        public IHttpActionResult DeleteYEAR(int id)
        {
            YEAR yEAR = db.YEARs.Find(id);

            if (yEAR == null)
            {
                return(NotFound());
            }

            db.YEARs.Remove(yEAR);
            db.SaveChanges();

            return(Ok(yEAR));
        }
Ejemplo n.º 10
0
 public void UpdateYear(YearDTO year, bool editar)
 {
     using (SEDESOLEntities entities = new SEDESOLEntities())
     {
         if (editar)
         {
             YEAR existente = entities.YEARs.FirstOrDefault(v => v.Id == year.Id);
             if (existente != null)
             {
                 existente.Description = year.Description;
                 entities.SaveChanges();
             }
         }
         else
         {
             YEAR nueva = new YEAR();
             nueva.Description = year.Description;
             nueva.IsActive    = true;
             entities.YEARs.Add(nueva);
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 11
0
        //-----------------------------------------------------------------------
        public override ValueRange java.time.temporal.TemporalAccessor_Fields.range(TemporalField field)
        {
            if (field is ChronoField)
            {
                if (IsSupported(field))
                {
                    ChronoField f = (ChronoField)field;
                    switch (f)
                    {
                    case DAY_OF_MONTH:
                    case DAY_OF_YEAR:
                    case ALIGNED_WEEK_OF_MONTH:
                        return(IsoDate.Range(field));

                    case YEAR_OF_ERA:
                    {
                        ValueRange java.time.temporal.TemporalAccessor_Fields.Range = YEAR.range();
                        long max = (ProlepticYear <= 0 ? -java.time.temporal.TemporalAccessor_Fields.Range.Minimum + 1 + YEARS_DIFFERENCE : java.time.temporal.TemporalAccessor_Fields.Range.Maximum - YEARS_DIFFERENCE);
                        return(ValueRange.Of(1, max));
                    }
                    }
                    return(Chronology.Range(f));
                }
                throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
            }
            return(field.RangeRefinedBy(this));
        }