Beispiel #1
0
        public ActionResult Create([Bind(Include = "ID,Name")] Subsidary subsidary)
        {
            if (ModelState.IsValid)
            {
                subsidariesBusinessManager.Add(subsidary);
                return(RedirectToAction("Index"));
            }

            return(View(subsidary));
        }
Beispiel #2
0
        // Adding a new Subsidary not in the database
        public ActionResult AddNewSubsidary(int empId, string subname)
        {
            var       empSub       = new EmpSubsidary();
            Subsidary NewSubsidary = new Subsidary();

            NewSubsidary.Name = subname;
            var added = subsidiariesbusinessManager.Add(NewSubsidary);

            empSub.EmpID = empId;
            List <Subsidary> sub = subsidiariesbusinessManager.GetUnmappedSubsidiariesByEmpID(empId);

            if (sub.Where(j => j.ID == added.ID).FirstOrDefault() != null)
            {
                empSub.SubsidaryID = added.ID;
                empSubsBusinessManager.Add(empSub);
            }
            var empSubs = empSubsBusinessManager.GetByEmployeeID(empId);

            return(PartialView("_UserSubs", empSubs));
        }