Example #1
0
        public ActionResult Create([Bind(Include = "EmployeeId,EmployeeName,EmployeeEmail,EmployeePassword,MGR,DateofBirth")] Employee employee)
        {
            employee.Status = "New";
            if (ModelState.IsValid)
            {
                Service.Insert(employee);
                var employeeList = Service.GetAll().Where(item => item.EmployeeEmail == employee.EmployeeEmail);
                foreach (var items in employeeList)
                {
                    EmployeeBio employeeBio = new EmployeeBio
                    {
                        EmployeeAddress = "No address given",
                        DateofBirth     = items.DateofBirth,
                        HireDate        = DateTime.Now,
                        EmployeeId      = items.EmployeeId
                    };

                    new ServiceFactory().Create <EmployeeBio>().Insert(employeeBio);
                }

                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeBio employeeBio = db.EmployeeBios.Find(id);

            db.EmployeeBios.Remove(employeeBio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "EmployeeBioId,EmployeeContactNo,EmployeeAddress,DateofBirth,HireDate,Intro,Objectives,Hobbies,Interests,Certificates,JobExperience,Eduction,EmployeeId,Image")] EmployeeBio employeeBio)
 {
     if (ModelState.IsValid)
     {
         Service.Update(employeeBio, employeeBio.EmployeeBioId);
         return(RedirectToAction("Details"));
     }
     return(View(employeeBio));
 }
Example #4
0
        //// GET: Biography
        //public ActionResult Index()
        //{
        //    return View(db.EmployeeBios.ToList());
        //}

        // GET: Biography/Details/5
        public ActionResult Details()
        {
            EmployeeBio employeeBio = Service.Get(Int32.Parse(Session["Id"].ToString()));

            if (employeeBio == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeBio));
        }
Example #5
0
 public ActionResult Edit([Bind(Include = "EmployeeBioId,EmployeeContactNo,EmployeeAddress,DateofBirth,HireDate,Intro,Objectives,Hobbies,Interests,Certificates,JobExperience,Eduction,EmployeeId,Image")] EmployeeBio employeeBio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeBio).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeeBio));
 }
Example #6
0
        //// GET: Biography/Create
        //public ActionResult Create()
        //{
        //    return View();
        //}

        //// POST: Biography/Create
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "EmployeeBioId,EmployeeContactNo,EmployeeAddress,DateofBirth,HireDate,Intro,Objectives,Hobbies,Interests,Certificates,JobExperience,Eduction,EmployeeId,Image")] EmployeeBio employeeBio)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.EmployeeBios.Add(employeeBio);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(employeeBio);
        //}

        // GET: Biography/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeBio employeeBio = Service.Get(id);

            if (employeeBio == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeBio));
        }
Example #7
0
        // GET: Profile/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeBio employeeBio = db.EmployeeBios.Find(id);

            if (employeeBio == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeBio));
        }
Example #8
0
        public ActionResult Edit([Bind(Include = "EmployeeBioId,EmployeeContactNo,EmployeeAddress,DateofBirth,HireDate,Intro,Objectives,Hobbies,Interests,Certificates,JobExperience,Eduction,EmployeeId,Image")] EmployeeBio employeeBio)
        {
            if (Debugger.IsAttached)
            {
                Output.Write("In post method of employee bio update");
                Output.Write("ModelState informations are: " + ModelState.Values);
            }

            if (ModelState.IsValid)
            {
                Service.Update(employeeBio, employeeBio.EmployeeBioId);
                return(RedirectToAction("Details"));
            }
            return(View(employeeBio));
        }
Example #9
0
        //// GET: Biography
        //public ActionResult Index()
        //{
        //    return View(db.EmployeeBios.ToList());
        //}

        // GET: Biography/Details/5
        public ActionResult Details()
        {
            EmployeeBio employeeBio = Service.Get(Int32.Parse(Session["EmployeeBioId"].ToString()));


            if (Debugger.IsAttached)
            {
                Output.Write("Employee bio found is: ");
                Output.Write(employeeBio.EmployeeId + " : " + employeeBio.EmployeeContactNo +
                             " : " + employeeBio.HireDate);
            }

            if (employeeBio == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeBio));
        }
Example #10
0
        //// GET: Biography/Create
        //public ActionResult Create()
        //{
        //    return View();
        //}

        //// POST: Biography/Create
        //// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        //// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "EmployeeBioId,EmployeeContactNo,EmployeeAddress,DateofBirth,HireDate,Intro,Objectives,Hobbies,Interests,Certificates,JobExperience,Eduction,EmployeeId,Image")] EmployeeBio employeeBio)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.EmployeeBios.Add(employeeBio);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }

        //    return View(employeeBio);
        //}

        // GET: Biography/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeBio employeeBio = Service.Get(id);

            if (Debugger.IsAttached)
            {
                Output.Write("In Get method of employeebio edit");
                Output.Write("Found the following information from service for employee bio: ");
                Output.Write(employeeBio.EmployeeId + " : " + employeeBio.EmployeeContactNo + " : "
                             + employeeBio.HireDate);
            }
            if (employeeBio == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeBio));
        }