public async Task <ActionResult> Edit([Bind(Include = "Id,Title")] PropertyLinkText propertyLinkText)
        {
            if (ModelState.IsValid)
            {
                db.Entry(propertyLinkText).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(propertyLinkText));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,Title")] PropertyLinkText propertyLinkText)
        {
            if (ModelState.IsValid)
            {
                db.PropertyLinkTexts.Add(propertyLinkText);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(propertyLinkText));
        }
        // GET: Admin/PropertyLinkText/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PropertyLinkText propertyLinkText = await db.PropertyLinkTexts.FindAsync(id);

            if (propertyLinkText == null)
            {
                return(HttpNotFound());
            }
            return(View(propertyLinkText));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            PropertyLinkText propertyLinkText = await db.PropertyLinkTexts.FindAsync(id);


            //db.PropertyLinkTexts.Remove(propertyLinkText);
            //await db.SaveChangesAsync();
            var isUnused = await db.Propertys.CountAsync(i => i.PropertyLinkTextId.Equals(id)) == 0;

            if (isUnused)
            {
                db.PropertyLinkTexts.Remove(propertyLinkText);
                await db.SaveChangesAsync();
            }



            return(RedirectToAction("Index"));
        }