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)); }
public ActionResult DeleteConfirmed(int id) { YEAR yEAR = db.YEARS.Find(id); db.YEARS.Remove(yEAR); db.SaveChanges(); return(RedirectToAction("Index")); }
public void DeactivateYear(int id) { using (SEDESOLEntities entities = new SEDESOLEntities()) { YEAR year = entities.YEARs.Find(id); year.IsActive = false; entities.SaveChanges(); } }
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)); }
public ActionResult Create([Bind(Include = "yearid,yearref")] YEAR yEAR) { if (ModelState.IsValid) { db.YEARS.Add(yEAR); db.SaveChanges(); return(RedirectToAction("Create")); } return(View(yEAR)); }
public IHttpActionResult GetYEAR(int id) { YEAR yEAR = db.YEARs.Find(id); if (yEAR == null) { return(NotFound()); } return(Ok(yEAR)); }
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)); }
// 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)); }
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)); }
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(); } } }
//----------------------------------------------------------------------- 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)); }