Example #1
0
        // PUT api/Event/5
        public IHttpActionResult PutCalendarEvent(int id, CalendarEvent calendarevent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != calendarevent.Id)
            {
                return(BadRequest());
            }

            using (EventOrganizerEntities eventOrganizerEntities = new EventOrganizerEntities())
            {
                try
                {
                    eventOrganizerEntities.Entry(calendarevent).State = EntityState.Modified;
                    eventOrganizerEntities.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CalendarEventExists(id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
 public ActionResult Edit([Bind(Include = "Id,EventTitle,Abstract,EventDescription,StartDate,EndDate,Location,Url,Price,EventGroupTitle,EventGroupName,EventTypeOne,CreatedDateTime,LastUpdateDateTime,IsDeleted")] CalendarEvent calendarevent)
 {
     if (ModelState.IsValid)
     {
         using (EventOrganizerEntities db = new EventOrganizerEntities())
         {
             db.Entry(calendarevent).State = EntityState.Modified;
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     return(View(calendarevent));
 }