Example #1
0
 public ActionResult Edit([Bind(Include = "id,DateTimeFrom,DateTimeTo,EmpId,Description")] OffDay offDays)
 {
     if (ModelState.IsValid)
     {
         db.Entry(offDays).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(offDays));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "EmployeeID,Name,PhoneNumber,City,PostalCode,StreetAddress")] EmployeeContacts employeeContacts)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeContacts).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index/" + employeeContacts.EmployeeID));
     }
     return(View(employeeContacts));
 }
 public ActionResult Edit([Bind(Include = "ID,ContactID,Name,Phone,Address,BillingAddress")] Client client)
 {
     if (ModelState.IsValid)
     {
         db.Entry(client).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(client));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "ID,EmpId,DateTimeFrom,DateTimeTo")] Schedules scheduleModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(scheduleModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index/" + scheduleModel.EmpId));
     }
     return(View(scheduleModel));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "ID,ServiceTypeID,ClientID")] Service service)
 {
     if (ModelState.IsValid)
     {
         db.Entry(service).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(service));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "ID,BranchName,Category,SubCategory,Description,MinutesPerUnit,CostPerUnit,Currency")] ServiceType serviceType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(serviceType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(serviceType));
 }
Example #7
0
 public ActionResult Edit([Bind(Include = "Name,ParentBranch,Address")] Branches branch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(branch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(branch));
 }
Example #8
0
        public ActionResult Edit([Bind(Include = "ContactName,ContactEmail,ContactPhone,ContactCity,ContactAddress")] EmergencyContact emergencyContact)
        {
            if (ModelState.IsValid)
            {
                db.Entry(emergencyContact).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index/" + emergencyContact.EmployeeID));
            }

            return(View(emergencyContact));
        }
Example #9
0
        public ActionResult Edit([Bind(Include = "ID,ContactID,EmployeeID,QualificationsID,Name,Password,Position,StaffType,EmailAddress,BranchName,Qualifications")] Employee employee,
                                 EmployeeContacts employeeContact, EmergencyContact emergencyContact, EmployeeQualifications qualify, string[] Qualifications, string id)
        {
            if (ModelState.IsValid)
            {
                for (int i = 0; i < Qualifications.Length; i++)
                {
                    string results = Qualifications[i];
                    qualify.Qualifications = results;
                    qualify.EmployeeID     = id;
                    db.EmployeeQualifications.Add(qualify);
                    db.SaveChanges();
                }

                employeeContact.EmployeeID  = id;
                emergencyContact.EmployeeID = id;

                db.Entry(employee).State         = EntityState.Modified;
                db.Entry(employeeContact).State  = EntityState.Modified;
                db.Entry(emergencyContact).State = EntityState.Modified;
                db.Entry(qualify).State          = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    //Safely ignore this exception
                }
                catch (Exception e)
                {
                    //Something else has occurred
                }

                return(RedirectToAction("Index"));
            }
            //return View(employee);
            return(View(employee));
        }