Exemple #1
0
        public ActionResult Create([Bind(Include = "CompanyDescClassID,ShortDesc,Address,Website,Telephone")] CompanyDescClass companyDescClass)
        {
            if (ModelState.IsValid)
            {
                CompanyOpenHours OpenHours = new CompanyOpenHours()
                {
                    mondayOpen     = "0000",
                    mondayClose    = "0000",
                    tuesdayOpen    = "0000",
                    tuesdayClose   = "0000",
                    wednesdayOpen  = "0000",
                    wednesdayClose = "0000",
                    thursdayOpen   = "0000",
                    thursdayClose  = "0000",
                    fridayOpen     = "0000",
                    fridayClose    = "0000",
                    saturdayOpen   = "0000",
                    saturdayClose  = "0000",
                    sundayOpen     = "0000",
                    sundayClose    = "0000"
                };
                List <CompanyEmployee> Employees = new List <CompanyEmployee>()
                {
                    new CompanyEmployee()
                    {
                        pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                    },
                    new CompanyEmployee()
                    {
                        pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                    },
                    new CompanyEmployee()
                    {
                        pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                    },
                    new CompanyEmployee()
                    {
                        pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                    },
                    new CompanyEmployee()
                    {
                        pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                    }
                };
                companyDescClass.Employees = Employees;
                companyDescClass.OpenHours = OpenHours;

                db.CompanyDescClasses.Add(companyDescClass);
                db.OpenHours.Add(companyDescClass.OpenHours);
                foreach (CompanyEmployee employee in companyDescClass.Employees)
                {
                    db.Employees.Add(employee);
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(companyDescClass));
        }
Exemple #2
0
 public ActionResult CreateOpenHours([Bind(Include = "CompanyOpenHoursID,mondayOpen,mondayClose,tuesdayOpen,tuesdayClose,wednesdayOpen,wednesdayClose,thursdayOpen,thursdayClose,fridayOpen,fridayClose,saturdayOpen,saturdayClose,sundayOpen,sundayClose")] CompanyOpenHours companyOpenHours)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyOpenHours).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Company"));
     }
     return(View(companyOpenHours));
 }
Exemple #3
0
        public ActionResult CreateOpenHours(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyOpenHours companyOpenHours = db.OpenHours.Find(id);

            if (companyOpenHours == null)
            {
                return(HttpNotFound());
            }
            return(View(companyOpenHours));
        }
Exemple #4
0
        public ActionResult CreateNew()
        {
            CompanyDescClass companyDescClass = new CompanyDescClass
            {
                ShortDesc = "Edit Short Description",
                Address   = "0 street name, City, Province",
                Website   = "*****@*****.**",
                Telephone = "(416) 000-0000"
            };
            CompanyOpenHours OpenHours = new CompanyOpenHours()
            {
                mondayOpen     = "0000",
                mondayClose    = "0000",
                tuesdayOpen    = "0000",
                tuesdayClose   = "0000",
                wednesdayOpen  = "0000",
                wednesdayClose = "0000",
                thursdayOpen   = "0000",
                thursdayClose  = "0000",
                fridayOpen     = "0000",
                fridayClose    = "0000",
                saturdayOpen   = "0000",
                saturdayClose  = "0000",
                sundayOpen     = "0000",
                sundayClose    = "0000"
            };
            List <CompanyEmployee> Employees = new List <CompanyEmployee>()
            {
                new CompanyEmployee()
                {
                    pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                },
                new CompanyEmployee()
                {
                    pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                },
                new CompanyEmployee()
                {
                    pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                },
                new CompanyEmployee()
                {
                    pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                },
                new CompanyEmployee()
                {
                    pictureID = "~/images/0.jpg", empName = "Edit Name", position = "Edit Title", CompanyEmployeeID = companyDescClass.CompanyDescClassID
                }
            };

            companyDescClass.Employees = Employees;
            companyDescClass.OpenHours = OpenHours;

            db.CompanyDescClasses.Add(companyDescClass);
            db.OpenHours.Add(companyDescClass.OpenHours);
            foreach (CompanyEmployee employee in companyDescClass.Employees)
            {
                db.Employees.Add(employee);
            }
            db.SaveChanges();


            return(View("View", companyDescClass));
        }