public ActionResult Edit(EmployeeViewModel model)
        {

            if (!System.IO.File.Exists(Server.MapPath("~/Employee_Files/" + model.EmployeeId + "/")))
            {
                Directory.CreateDirectory(Server.MapPath("~/Employee_Files/" + model.EmployeeId + "/"));
            }

            model.EmployeeTypes = new EmployeeTypeAppService().GetAllEmployeeType(); 

            try
            {
                var svc = new EmployeeAppService();

                var o = new Employee()
                {
                    UserId = model.UserId,
                    FullName = model.FullName,
                    EmployeeId = model.EmployeeId,
                    EMail = model.EMail,
                    Phone = model.Phone,
                    EmployeeTypeId = model.EmployeeTypeId,
                    Mobile = model.Mobile,
                    Photo = model.Photo

                };

                if (model.EmployeeId == -1)
                {
                    o.Photo = string.Empty;
                    svc.AddEmployee(o);
                    ViewBag.Feed = 0;
                }
                else
                {
                    o.EmployeeId = model.EmployeeId;
                    if (model.IsDeleteAction == 0)
                    {

                        svc.SaveEmployee(o);
                    }
                    else
                    {
                        svc.RemoveEmployee(model.EmployeeId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }
        
            model.UserList = new UserAppService().GetAllAvailableUser();
            return View(model);
        }
        public ActionResult Edit(EmployeeViewModel model)
        {

            try
            {
                var svc = new EmployeeAppService();

                var o = new Employee()
                {
                    UserId = model.UserId,
                    FullName = model.FullName,
                    EmployeeId = model.EmployeeId,
                    EMail = model.EMail,
                    Phone = model.Phone,
                    Mobile = model.Mobile,
                    Photo = model.Photo

                };

                if (model.EmployeeId == -1)
                {
                    svc.AddEmployee(o);
                    ViewBag.Feed = 0;
                }
                else
                {
                    o.EmployeeId = model.EmployeeId;
                    if (model.IsDeleteAction == 0)
                    {

                        svc.SaveEmployee(o);
                    }
                    else
                    {
                        svc.RemoveEmployee(model.EmployeeId);
                    }
                    ViewBag.Feed = 0;
                }
            }
            catch (Exception)
            {
                ViewBag.Feed = 1;

            }
        
            model.UserList = new UserAppService().GetAllAvailableUser();
            return View(model);
        }