Esempio n. 1
0
        public async Task <IActionResult> PutEventConfirmation([FromRoute] int id, [FromBody] EventConfirmation eventConfirmation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutEventInfo(int id, EventInfo eventInfo)
        {
            if (id != eventInfo.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,CityName,CityDescription,Population,Lada")] City city)
 {
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(city));
 }
 public ActionResult Edit([Bind(Include = "Id,NombreEvento,Seguridad,FechaEventoInicio,FechaEventoFinal")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@event));
 }
 public ActionResult Edit([Bind(Include = "Id,CiudadName,CiudadDescription,PostalCode")] Ciudad ciudad)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ciudad).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ciudad));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "ID,Nombre,Capacidad,Invitado,Fecha,Negocio")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@event));
 }
 public ActionResult Edit([Bind(Include = "Id,nombreevento,fechaevento,artistas,comida")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@event));
 }
Esempio n. 8
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,CodigoPostal")] City city)
 {
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(city));
 }
Esempio n. 9
0
 public ActionResult Edit([Bind(Include = "Title,description,StartDate,StartTime,EndDate,EndTime,Location,eventType,OrganizerName,ContactIndo,MaxTickets,AvailableTickets")] Event eventt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eventt));
 }
 public ActionResult Edit([Bind(Include = "Id,Nombre,Description,Fecha,Organisador,CityId")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId = new SelectList(db.Citys, "Id", "Nombre", @event.CityId);
     return(View(@event));
 }
Esempio n. 11
0
 public ActionResult Edit([Bind(Include = "Id,EventName,EventDescription,Fecha,Quota,Availability,CityId")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId = new SelectList(db.Cities, "Id", "CityName", @event.CityId);
     return(View(@event));
 }
 public ActionResult Edit([Bind(Include = "Id,Nombre,Descripcion,Fecha,CiudadesId")] Evento evento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CiudadesId = new SelectList(db.Ciudads, "Id", "CiudadName", evento.CiudadesId);
     return(View(evento));
 }
Esempio n. 13
0
 public ActionResult Edit([Bind(Include = "id,Title,Date,Place,CityId")] Evento evento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId = new SelectList(db.Cities, "id", "Name", evento.CityId);
     return(View(evento));
 }
Esempio n. 14
0
 public ActionResult Edit([Bind(Include = "Id,Title,Place,TypeEvent,DayEvent,Capacity,CityId")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CityId = new SelectList(db.Citys, "Id", "Name", "PostalCode", @event.CityId);
     return(View(@event));
 }
Esempio n. 15
0
 public void InsertOrUpdate(Event ev)
 {
     if (ev.Id == 0)
     {
         // New entity
         context.Events.Add(ev);
     }
     else
     {
         // Existing entity
         context.Entry(ev).State = System.Data.Entity.EntityState.Modified;
     }
 }
        public async Task <IActionResult> PutEvents(int id, [FromBody] Event events)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            //events.EventUser = _userManager.GetUserId(User);
            _context.Entry(events).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Esempio n. 17
0
 public virtual void Update(TEntity entityToUpdate)
 {
     dbSet.Attach(entityToUpdate);
     _db.Entry(entityToUpdate).State = EntityState.Modified;
 }