// GET: Sales_Person/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sales_Person sales_Person = db.Sales_people.Find(id);

            if (sales_Person == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TerritoryID = new SelectList(db.Territories, "TerritoryID", "TerritoryName", sales_Person.TerritoryID);
            return(View(sales_Person));
        }
Exemplo n.º 2
0
        public ActionResult Create(Sales_Person sales_Person)
        {
            sales_Person.IsActive       = true;
            sales_Person.Created        = GetDate;
            sales_Person.CreatedBy      = GetUserId;
            sales_Person.LastModified   = GetDate;
            sales_Person.LastModifiedBy = GetUserId;

            if (ModelState.IsValid)
            {
                _db.Sales_Person.Add(sales_Person);
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sales_Person));
        }