public async Task <ActionResult> DeleteConfirmed(int id)
        {
            GenContractor genContractor = await db.GenContractors.FindAsync(id);

            db.GenContractors.Remove(genContractor);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "GenContractorID,Name")] GenContractor genContractor)
        {
            if (ModelState.IsValid)
            {
                db.Entry(genContractor).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(genContractor));
        }
        public async Task <ActionResult> Create([Bind(Include = "GenContractorID,Name")] GenContractor genContractor)
        {
            if (ModelState.IsValid)
            {
                db.GenContractors.Add(genContractor);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(genContractor));
        }
Exemple #4
0
        public async Task <ActionResult> Edit([Bind(Include = "GenContractorID,Name")] GenContractor genContractor)
        {
            if (ModelState.IsValid)
            {
                db.Entry(genContractor).State = EntityState.Modified;
                await db.SaveChangesAsync();

                AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " finished editing. New values: " + " Gen Contractor ID: " + genContractor.GenContractorID + " Gen Contractor Name: " + genContractor.Name, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name));

                return(RedirectToAction("Index"));
            }
            return(View(genContractor));
        }
Exemple #5
0
        public async Task <ActionResult> Create([Bind(Include = "GenContractorID,Name")] GenContractor genContractor)
        {
            if (ModelState.IsValid)
            {
                db.GenContractors.Add(genContractor);
                await db.SaveChangesAsync();

                AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " created: " + " Gen Contractor ID: " + genContractor.GenContractorID + " Gen Contractor Name: " + genContractor.Name, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name));
                return(RedirectToAction("Index"));
            }

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

            if (genContractor == null)
            {
                return(HttpNotFound());
            }
            return(View(genContractor));
        }
Exemple #7
0
        // GET: GenContractors/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GenContractor genContractor = await db.GenContractors.FindAsync(id);

            if (genContractor == null)
            {
                return(HttpNotFound());
            }
            AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " is attempting to edit. Previous values: " + " Gen Contractor ID: " + genContractor.GenContractorID + " Gen Contractor Name: " + genContractor.Name, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name));
            return(View(genContractor));
        }
Exemple #8
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                GenContractor genContractor = await db.GenContractors.FindAsync(id);

                db.GenContractors.Remove(genContractor);
                await db.SaveChangesAsync();

                AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " deleted " + genContractor.Name + " " + genContractor.GenContractorID, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name));

                return(RedirectToAction("Index"));
            }
            catch (DbUpdateException e)
            {
                Response.Write("<script language='javascript'>alert(" + e.Message + ")</script>");
                logger.Error(e);
                return(RedirectToAction("Index"));
            }
        }