Пример #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            RareResource rareResource = await db.RareResources.FindAsync(id);

            db.RareResources.Remove(rareResource);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <ActionResult> Edit([Bind(Include = "PrimaryKey,Name,ImgUrl")] RareResource rareResource)
        {
            if (ModelState.IsValid)
            {
                db.Entry(rareResource).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(rareResource));
        }
Пример #3
0
        public async Task <ActionResult> Create([Bind(Include = "PrimaryKey,Name,ImgUrl")] RareResource rareResource)
        {
            if (ModelState.IsValid)
            {
                db.RareResources.Add(rareResource);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(rareResource));
        }
Пример #4
0
        // GET: RareResources/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RareResource rareResource = await db.RareResources.FindAsync(id);

            if (rareResource == null)
            {
                return(HttpNotFound());
            }
            return(View(rareResource));
        }