Esempio n. 1
0
        // GET: Histories/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HistoryW history = db.HistoryW.Find(id);

            String[] tab = history.Search.Split(':');
            String   pom = tab[1];

            if (tab[0] == "Wystawca")
            {
                Company c = db.Companies.Single(p => p.Email == pom);
                history.Search = "<a href=\"/Companies/Details/" + c.Id + "\">" + c.CompanyName + "</a>";
            }
            else if (tab[0] == "Uczestnik")
            {
                User c = db.Users.Single(p => p.Email == pom);
                history.Search = "<a href=\"/Users/Details/" + c.ID + "\">" + c.SurName + " " + c.ForName + "</a>";
            }
            if (history == null)
            {
                return(HttpNotFound());
            }
            return(View(history));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(long id)
        {
            HistoryW history = db.HistoryW.Find(id);
            long     ide     = history.Expo.Id;

            db.HistoryW.Remove(history);
            db.SaveChanges();
            return(RedirectToAction("List", new { id = ide }));
        }
Esempio n. 3
0
        // GET: Histories/Create
        public ActionResult Create(long?id)
        {
            HistoryW h = new HistoryW();

            h.Expo        = db.Expos.Single(p => p.Id == id);
            h.Company     = db.Companies.Single(p => p.Email == User.Identity.Name);
            h.Search      = "Wystawca:[email protected]";
            h.Description = "Reklama";
            db.HistoryW.Add(h);
            db.SaveChanges();
            return(RedirectToAction("List"));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "ID,Search,Description")] History history)
 {
     if (ModelState.IsValid)
     {
         HistoryW h   = db.HistoryW.Find(history.ID);
         long     ide = h.Expo.Id;
         UpdateModel(h);
         db.SaveChanges();
         return(RedirectToAction("List", new { id = ide }));
     }
     return(View(history));
 }
Esempio n. 5
0
        // POST: Histories/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.

        // GET: Histories/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HistoryW history = db.HistoryW.Find(id);

            if (history == null)
            {
                return(HttpNotFound());
            }
            return(View(history));
        }
Esempio n. 6
0
        public ActionResult insertHistoryC(string Search, string Description, long Companyid, int Expoid)
        {
            ExpoesContext expo = new ExpoesContext();
            HistoryW      h    = new HistoryW()
            {
                Search      = Search,
                Description = Description,
                Company     = expo.Companies.Single(p => p.Id == Companyid),
                Expo        = expo.Expos.Single(p => p.Id == Expoid)
            };

            expo.HistoryW.Add(h);
            expo.SaveChanges();
            expo.Configuration.ProxyCreationEnabled = false;
            var data = new { saved = true };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }