Exemple #1
0
        public IHttpActionResult PutCalendar(int id, Calendar calendar)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != calendar.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
        public async Task <IActionResult> PutTblEvent(int id, [FromBody]  TblEvent tblEvent)
        {
            if (id != tblEvent.Id)
            {
                return(BadRequest());
            }

            _context.Entry(tblEvent).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TblEventExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "ID,Title,StartDate,EndDate")] Calendar calendar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(calendar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(calendar));
 }