Exemplo n.º 1
0
        // GET: /ConsumerRepAreaOfInterest/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ConsumerRepAreaOfInterestModel consumerrepareaofinterestmodel = await db.ConsumerRepAreasOfInterest.FindAsync(id);

            if (consumerrepareaofinterestmodel == null)
            {
                return(HttpNotFound());
            }
            return(View(consumerrepareaofinterestmodel));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Delete(int id)
        {
            try
            {
                ConsumerRepAreaOfInterestModel consumerrepareaofinterestmodel = await db.ConsumerRepAreasOfInterest.FindAsync(id);

                db.ConsumerRepAreasOfInterest.Remove(consumerrepareaofinterestmodel);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch (DataException /* dex */)
            {
                // Log the error
                return(RedirectToAction("Delete", new { id = id, saveChangesError = true }));
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        // GET: /ConsumerRepAreaOfInterest/Delete/5
        public async Task <ActionResult> Delete(int?id, bool?saveChangesError = false)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (saveChangesError.GetValueOrDefault())
            {
                ViewBag.ErrorMessage = "Delete failed. Please try again";
            }
            ConsumerRepAreaOfInterestModel consumerrepareaofinterestmodel = await db.ConsumerRepAreasOfInterest.FindAsync(id);

            if (consumerrepareaofinterestmodel == null)
            {
                return(HttpNotFound());
            }
            return(View(consumerrepareaofinterestmodel));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "ConsumerRepAreaOfInterestModelID,AreaOfInterestName")] ConsumerRepAreaOfInterestModel consumerrepareaofinterestmodel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(consumerrepareaofinterestmodel).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException /* dex */)
            {
                // Log the error
                ModelState.AddModelError("", "Unable to save changes. Please try again.");
            }
            return(View(consumerrepareaofinterestmodel));
        }