// PUT api/<controller>/5
 public void Put(int id, [FromBody]Department value)
 {
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
         svc.UpdateDepartment(value);
     }
 }
 // DELETE api/<controller>/5
 public void Delete(int id)
 {
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
          svc.DeleteDepartment(id);
     }
 }
 // GET api/<controller>/5
 public Department Get(int id)
 {
     Department dept=null;
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
        dept= svc.ReadDepartment(id);
     }
     return dept;
 }
 // GET api/<controller>
 public List<Department> Get()
 {
     List<Department> deptcoll = null;
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
         deptcoll = svc.GetAllDepartments();
     }
     return deptcoll;
 }
 // POST api/<controller>
 public void Post([FromBody]string value)
 {
     if(!(string.IsNullOrWhiteSpace(value)))
        {
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
          svc.CreateDepartment(value);
     }
        }
 }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here
                var deptName = GetDeptName(collection);
                if (!(string.IsNullOrWhiteSpace(deptName)))
                {
                    using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
                    {

                        svc.CreateDepartment(deptName);
                    }
                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                  var deptName = GetDeptName(collection);
                  if (!(string.IsNullOrWhiteSpace(deptName)))
                  {
                      using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
                      {

                      }
                  }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
 //
 // GET: /Department/
 public ActionResult Index()
 {
     List<Department> deptColl;
     using (EmpMgmtSvc.EmployeeMgmtServiceClient svc = new EmpMgmtSvc.EmployeeMgmtServiceClient())
     {
         deptColl = svc.GetAllDepartments();
     }
     return View(deptColl);
 }