Пример #1
0
        public IHttpActionResult PutEvent(int id, Event @event)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(@event).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public ActionResult Create(Course course)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(course);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(course));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "AreaId,Name")] Area area)
        {
            if (ModelState.IsValid)
            {
                db.Areas.Add(area);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(area));
        }
        public ActionResult Create([Bind(Include = "Id,Name")] EventType eventtype)
        {
            if (ModelState.IsValid)
            {
                db.EventTypes.Add(eventtype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eventtype));
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "RepID,FirstName,LastName,RegionID,Twitter,Facebook,Instagram,Email,Active")] Reps reps)
        {
            if (ModelState.IsValid)
            {
                db.Reps.Add(reps);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(reps));
        }
        public ActionResult Create([Bind(Include = "ID,Title,Date,Time,Location")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(@event));
        }
        public ActionResult Create([Bind(Include = "Id,OrderDate,NumOfTickets,User")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(order));
        }
        public ActionResult Create(Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(student));
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "RegionID,Region")] Regions regions)
        {
            if (ModelState.IsValid)
            {
                db.Regions.Add(regions);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(regions));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "EventID,EventTitle,EventDirector,EventDistribution,EventTickets,EventReleaseDate")] EventModel eventmodel)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(eventmodel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eventmodel));
        }
Пример #11
0
        public ActionResult Create([Bind(Include = "Id,EventTypeId,Title,Description,StartDateTime,EndDateTime,LocationCity,LocationState,Organizer,MaxTickets,AvailableTickets")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EventTypeId = new SelectList(db.EventTypes, "Id", "Name", @event.EventTypeId);
            return(View(@event));
        }
        public ActionResult Create(Event event1)
        {
            if (ModelState.IsValid)
            {
                event1.UserName = Session["UserName"].ToString();
                db.Events.Add(event1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(event1));
        }
        public ActionResult Create([Bind(Include = "Id,AreaId,Name,Address,Capacity,Image")] EventVenue eventvenue)
        {
            if (ModelState.IsValid)
            {
                db.Venues.Add(eventvenue);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AreaId = new SelectList(db.Areas, "AreaId", "Name", eventvenue.AreaId);
            return(View(eventvenue));
        }
        public ActionResult Create([Bind(Include = "Id,EventTypeId,EventVenueId,EventName,Details,Data")] EventInfo eventinfo)
        {
            if (ModelState.IsValid)
            {
                db.EventInfos.Add(eventinfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EventTypeId  = new SelectList(db.EventTypes, "Id", "Name", eventinfo.EventTypeId);
            ViewBag.EventVenueId = new SelectList(db.Venues, "Id", "Name", eventinfo.EventVenueId);
            return(View(eventinfo));
        }
Пример #15
0
 public void Post([FromBody] Kayttajat kayttaja)
 {
     using (EventDBContext db = new EventDBContext())
     {
         db.Kayttajat.Add(kayttaja);
         db.SaveChanges();
     }
 }
Пример #16
0
 public EventData Add(EventData data)
 {
     //data.Id = events.Max(e => e.Id) + 1;
     //events.Add(data);
     _db.Events.Add(data);
     _db.SaveChanges();
     return(data);
 }
Пример #17
0
        public void Delete(int id)
        {
            using (EventDBContext db = new EventDBContext())
            {
                Tapahtumat t = db.Tapahtumat.Find(id);

                db.Tapahtumat.Remove(t);
                db.SaveChanges();
            }
        }
Пример #18
0
 public SearchController(EventDBContext context)
 {
     _context = context;
     if (_context.event_collects.Count() == 0)
     {
         _context.event_collects.Add(new DOEvent {
             event_id = Guid.NewGuid().ToString()
         });
         _context.SaveChanges();
     }
 }
Пример #19
0
 public void Post([FromBody] Tapahtumat tapahtumat)
 {
     using (EventDBContext db = new EventDBContext())
     {
         var paikkapalvelu = new GoogleLocationService(Environment.GetEnvironmentVariable("APIKey"));
         var latlong       = paikkapalvelu.GetLatLongFromAddress(tapahtumat.Sijainti);
         tapahtumat.Lat  = latlong.Latitude;
         tapahtumat.Long = latlong.Longitude;
         db.Tapahtumat.Add(tapahtumat);
         db.SaveChanges();
     }
 }
Пример #20
0
        // GET: Order
        public ActionResult Create(int tickets, int id)
        {
            Order order = new Order {
                OrderDate    = DateTime.Today,
                NumOfTickets = tickets,
                Evnt         = db.Events.Single(e => e.Id == id),
                User         = User.Identity.Name
            };

            db.Orders.Add(order);
            db.SaveChanges();

            return(View());
        }
Пример #21
0
 public void Put(int id, [FromBody] Tapahtumat tapahtumat)
 {
     using (EventDBContext db = new EventDBContext())
     {
         Tapahtumat t             = db.Tapahtumat.Find(id);
         var        paikkapalvelu = new GoogleLocationService(Environment.GetEnvironmentVariable("APIKey"));
         var        latlong       = paikkapalvelu.GetLatLongFromAddress(t.Sijainti);
         t.Lat        = latlong.Latitude;
         t.Long       = latlong.Longitude;
         t.Hinta      = tapahtumat.Hinta;
         t.Ikäraja    = tapahtumat.Ikäraja;
         t.Kategoria  = tapahtumat.Kategoria;
         t.Kuva       = tapahtumat.Kuva;
         t.Kuvaus     = tapahtumat.Kuvaus;
         t.Linkki     = tapahtumat.Linkki;
         t.Nimi       = tapahtumat.Nimi;
         t.Päivämäärä = tapahtumat.Päivämäärä;
         t.Sijainti   = tapahtumat.Sijainti;
         db.SaveChanges();
     }
 }
 public void Add(data.Event e)
 {
     context.Event.Add(e);
     context.SaveChanges();
 }