Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClosedBusiness closedBusiness = db.ClosedBusinesses.Find(id);

            db.ClosedBusinesses.Remove(closedBusiness);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Address,DateClosed,CurrentStatus,ArticleLink,Img,Details,TotalMoneyOwed")] ClosedBusiness closedBusiness)
 {
     if (ModelState.IsValid)
     {
         db.Entry(closedBusiness).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(closedBusiness));
 }
        public ActionResult Create([Bind(Include = "Id,Name,Address,DateClosed,CurrentStatus,ArticleLink,Img,Details")] ClosedBusiness closedBusiness)
        {
            if (ModelState.IsValid)
            {
                db.ClosedBusinesses.Add(closedBusiness);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(closedBusiness));
        }
Beispiel #4
0
        // GET: ClosedBusinessesAdmin/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClosedBusiness closedBusiness = db.ClosedBusinesses.Find(id);

            if (closedBusiness == null)
            {
                return(HttpNotFound());
            }
            return(View(closedBusiness));
        }
Beispiel #5
0
        // GET: ClosedBusinessInReview/PassThrough/5
        public ActionResult PassThrough(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //Edit loads from the
            ClosedBusiness closedBusiness = db.ClosedBusinesses.Find(id);

            if (closedBusiness == null)
            {
                return(HttpNotFound());
            }
            return(View(closedBusiness));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "Id,Name,Address,DateClosed,CurrentStatus,ArticleLink,Img,Details,TotalMoneyOwed")] ClosedBusiness closedBusiness)
        {
            if (ModelState.IsValid)
            {
                db.ClosedBusinesses.Add(closedBusiness);
                db.SaveChanges();
                List <Tag> lt = GenerateTownTags(closedBusiness);
                foreach (var t in lt)
                {
                    db.Tags.Add(t);
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(closedBusiness));
        }
Beispiel #7
0
        private List <Tag> GenerateTownTags(ClosedBusiness closedBusiness)
        {
            List <Tag> returnable = new List <Tag>();
            var        normalized = closedBusiness.Address.ToLowerInvariant();
            int        count      = 0;

            foreach (var name in Towns.NamesNormalized)
            {
                if (normalized.Contains(name))
                {
                    returnable.Add(new Tag
                    {
                        Name           = Towns.Names[count],
                        TaggedBusiness = closedBusiness,
                        Type           = "Town"
                    });
                }
                count++;
            }
            return(returnable);
        }
 private List<Tag> GenerateTownTags( ClosedBusiness closedBusiness)
 {
     List<Tag> returnable = new List<Tag>();
     var normalized = closedBusiness.Address.ToLowerInvariant();
     int count = 0;
     foreach (var name in Towns.NamesNormalized)
     {
         if (normalized.Contains(name))
         {
             returnable.Add(new Tag
             {
                 Name = Towns.Names[count],
                 TaggedBusiness = closedBusiness,
                 Type = "Town"
             });
         }
         count++;
     }
     return returnable;
 }