public IHttpActionResult Putannouncement(int id, announcement announcement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != announcement.ID_announcement)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public ActionResult JoinUs(club_member cm)
        {
            ViewBag.IsAdmin = (bool)Session["adminLoggedIn"];

            if (cm.firstName == null)
            {
                return(View());
            }
            else
            {
                if (ModelState.IsValid)
                {
                    cm.joinDate = DateTime.Now.Date;
                    cm.status   = "Pending";
                    edb.club_member.Add(cm);
                    edb.SaveChanges();

                    ViewBag.JoinSuccess = "true";
                    return(GetClubHomeView());
                }
                else
                {
                    ViewBag.JoinSuccess = null;
                    return(View(cm));
                }
            }
        }
예제 #3
0
        // POST api/<controller>
        public void Post([FromBody] dynamic data)
        {
            //string ss = (string)data;
            //customer newCust = JsonConvert.DeserializeObject<customer>(ss);
            customer newCust = new customer {
                name = data.name
            };

            edb.customers.Add(newCust);
            edb.SaveChanges();
        }
예제 #4
0
        public ActionResult DeleteOrder(int ID)
        {
            sandboxEntities sbxDB = new sandboxEntities();

            var odr = new order {
                id = ID
            };

            sbxDB.orders.Attach(odr);
            sbxDB.orders.Remove(odr);
            sbxDB.SaveChanges();

            //List<order> orders = (from o in sbxDB.orders
            //                      select o).ToList();

            //return PartialView("Orders", orders);
            return(Content(""));
        }