예제 #1
0
        public ActionResult Manage()
        {
            centerDetailsViewModel centerVM = new centerDetailsViewModel();

            if (Session["Center"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            int          centerID     = (int)Session["Center"];
            BeautyCenter beautyCenter = context.BeautyCenters.Where(c => c.ID == centerID).FirstOrDefault();

            if (beautyCenter.IsDeleted == true)
            {
                TempData["Message"] = "نأسف لعدم قبول المركز \n فهناك بعض البيانات التي يجب إدخالها صحيح برجاء إعادة محاولة التسجيل";
                return(RedirectToAction("Index"));
            }

            if (beautyCenter.IsApproved == false)
            {
                TempData["Message"] = "شكرا لتسجيلكم معنا \n سوف يتم مراجعة البيانات والرد عليكم خلال 24 ساعة";
                return(RedirectToAction("Index"));
            }
            else
            {
                centerVM.Center         = beautyCenter;
                centerVM.centerServices = context.CentersServices.Where(c => c.isDeleted == false && c.ID == centerID).ToList();
                centerVM.Employees      = context.Employees.Where(c => c.IsDeleted == false && c.CenterID == centerID).ToList();
                return(View(centerVM));
            }
        }
예제 #2
0
        public ActionResult createEmployee(EmployeeVM newEmp)
        {
            try
            {
                BeautyCenter center   = getCenter();
                int          centerID = center.ID;
                if (!ModelState.IsValid)
                {
                    return(View(newEmp));
                }
                int empID = getEmployee(newEmp, centerID);

                foreach (var service in newEmp.ServiceCenterList)
                {
                    if (service.isSelected)
                    {
                        EmployeeDoService empDoService = new EmployeeDoService()
                        {
                            ServiceID  = service.ServiceID,
                            EmployeeID = empID
                        };
                        context.EmployeeDoServices.Add(empDoService);
                        context.SaveChanges();
                    }
                }


                return(RedirectToAction("getEmployess"));
            }
            catch (Exception)
            {
                return(View(newEmp));
            }
        }
예제 #3
0
        public ActionResult getServices()
        {
            BeautyCenter center   = getCenter();
            int          centerID = center.ID;
            var          services = context.CentersServices.Where(cs => cs.CenterID == centerID && cs.isDeleted == false).ToList();

            return(View(services));
        }
예제 #4
0
        public ActionResult createService()
        {
            BeautyCenter         center    = getCenter();
            serviceCenterAdminVM serviceVM = new serviceCenterAdminVM();

            serviceVM.services          = context.Services.Where(c => c.IsDeleted == false).ToList();
            serviceVM.centerServiceList = context.CentersServices.Where(c => c.CenterID == center.ID && c.isDeleted == false).ToList();
            return(View(serviceVM));
        }
예제 #5
0
        public ActionResult createEmployee()
        {
            BeautyCenter center   = getCenter();
            int          centerID = center.ID;
            var          services = context.CentersServices.Where(cs => cs.CenterID == centerID && cs.isDeleted == false).ToList();
            EmployeeVM   employee = new EmployeeVM()
            {
                ServiceCenterList = services
            };

            return(View(employee));
        }
예제 #6
0
        public ActionResult EditEmployee(int id)
        {
            BeautyCenter center   = getCenter();
            int          centerID = center.ID;
            var          services = context.CentersServices.Where(cs => cs.CenterID == centerID && cs.isDeleted == false).ToList();
            EmployeeVM   empVM    = new EmployeeVM();
            var          emp      = context.Employees.Where(e => e.ID == id).FirstOrDefault();

            empVM.Name = emp.Name;
            empVM.ID   = emp.ID;
            empVM.ServiceCenterList = services;
            return(View(empVM));
        }
예제 #7
0
        private void addBeautyCenter(AdminClientViewModel newCenter, string ImageFileName)
        {
            BeautyCenter center = new BeautyCenter()
            {
                Name        = newCenter.CenterName,
                CityID      = newCenter.CityID,
                Logo        = ImageFileName,
                Gender      = newCenter.Gender,
                Description = newCenter.Description,
                Address     = newCenter.Address,
                UpdatedDate = DateTime.Now
            };

            context.BeautyCenters.Add(center);
            context.SaveChanges();
        }