Example #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            InfoServer infoServer = await db.InfoServers.FindAsync(id);

            db.InfoServers.Remove(infoServer);
            await db.SaveChangesAsync();

            return(RedirectToAction("ServerData"));
        }
Example #2
0
        public async Task <ActionResult> ServerEdit([Bind(Include = "ServerID,Status,ServerName,Environment,ActiveBookingID,UserID")] InfoServer infoServer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(infoServer).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("ServerData"));
            }
            return(View(infoServer));
        }
Example #3
0
        public async Task <ActionResult> ServerCreate([Bind(Include = "ServerID,Status,ServerName,Environment,ActiveBookingID,UserID")] InfoServer infoServer)
        {
            if (ModelState.IsValid)
            {
                db.InfoServers.Add(infoServer);
                await db.SaveChangesAsync();

                return(RedirectToAction("ServerData"));
            }

            return(View(infoServer));
        }
Example #4
0
        // GET: CRUD/Edit/5
        public async Task <ActionResult> ServerEdit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InfoServer infoServer = await db.InfoServers.FindAsync(id);

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