コード例 #1
0
 public ActionResult Edit([Bind(Include = "periodEndDate")] timeperiod timeperiod)
 {
     if (ModelState.IsValid)
     {
         db.Entry(timeperiod).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(timeperiod));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Employee_employeeID,TimePeriod_periodEndDate,isApproved")] employeetimeperiod employeetimeperiod)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeetimeperiod).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Employee_employeeID      = new SelectList(db.employees, "employeeID", "employeeFirstName", employeetimeperiod.Employee_employeeID);
     ViewBag.TimePeriod_periodEndDate = new SelectList(db.timeperiods, "periodEndDate", "periodEndDate", employeetimeperiod.TimePeriod_periodEndDate);
     return(View(employeetimeperiod));
 }
コード例 #3
0
ファイル: FavoriteController.cs プロジェクト: mlseck/Cronus
 public ActionResult Edit([Bind(Include = "favoriteID,Employee_employeeID,Activity_activityID")] favorite favorite)
 {
     if (ModelState.IsValid)
     {
         db.Entry(favorite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Activity_activityID = new SelectList(db.activities, "activityID", "activityName", favorite.Activity_activityID);
     ViewBag.Employee_employeeID = new SelectList(db.employees, "employeeID", "employeeFirstName", favorite.Employee_employeeID);
     return(View(favorite));
 }
コード例 #4
0
 public void InsertOrUpdate(activity activity)
 {
     if (Find(activity.activityID) == null)
     {
         // New entity
         context.activities.Add(activity);
     }
     else
     {
         // Existing entity
         context.Entry(activity).State = EntityState.Modified;
     }
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "entryID,hours,date,comments,TimePeriod_employeeID,TimePeriod_periodEndDate,Activity_activityID,Project_projectID")] hoursworked hoursworked)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hoursworked).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Activity_activityID   = new SelectList(db.activities, "activityID", "activityName", hoursworked.Activity_activityID);
     ViewBag.TimePeriod_employeeID = new SelectList(db.employeetimeperiods, "Employee_employeeID", "Employee_employeeID", hoursworked.TimePeriod_employeeID);
     ViewBag.Project_projectID     = new SelectList(db.projects, "projectID", "projectName", hoursworked.Project_projectID);
     return(View(hoursworked));
 }
コード例 #6
0
ファイル: EmployeeRepository.cs プロジェクト: mlseck/Cronus
 public void InsertOrUpdate(employee employee)
 {
     if (Find(employee.employeeID) == null)
     {
         // New entity
         context.employees.Add(employee);
     }
     else
     {
         // Existing entity
         context.Entry(employee).State = EntityState.Modified;
     }
 }
コード例 #7
0
 public void InsertOrUpdate(hoursworked hoursworked)
 {
     //if (hoursworked.hoursworkedID == default(int))
     if (Find(hoursworked.entryID) == null)
     {
         // New entity
         context.hoursworkeds.Add(hoursworked);
     }
     else
     {
         // Existing entity
         context.Entry(hoursworked).State = EntityState.Modified;
     }
 }
コード例 #8
0
ファイル: GroupRepository.cs プロジェクト: mlseck/Cronus
 public void InsertOrUpdate(group group)
 {
     //if (group.groupID == default(int))
     if (FindGroup(group.groupID) == null)
     {
         // New entity
         context.groups.Add(group);
     }
     else
     {
         // Existing entity
         context.Entry(group).State = EntityState.Modified;
     }
 }
コード例 #9
0
ファイル: FavoriteRepository.cs プロジェクト: mlseck/Cronus
 public void InsertOrUpdate(favorite favorite)
 {
     //if (favorite.favoriteID == default(int))
     if (Find(favorite.favoriteID) == null)
     {
         // New entity
         context.favorites.Add(favorite);
     }
     else
     {
         // Existing entity
         context.Entry(favorite).State = EntityState.Modified;
     }
 }
コード例 #10
0
ファイル: ApproverController.cs プロジェクト: mlseck/Cronus
        public ActionResult ApproverIndex(ApproverViewModel approverViewModel)
        {
            if (ModelState.IsValid)
            {
                //if (project.activityIds != null)
                //{
                //    project.activities = (from s in this.activityRepository.All where project.activityIds.Contains(s.activityID) select s).ToList();
                //}
                foreach (employeetimeperiod employeetp in approverViewModel.employeetimeperiods)
                {
                    db.Entry(employeetp).State = EntityState.Modified;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(approverViewModel));
        }
コード例 #11
0
        public void InsertOrUpdate(project project)
        {
            //if (project.projectID == default(int))
            if (Find(project.projectID) == null)
            {
                // New entity
                context.projects.Add(project);
            }
            else
            {
                //var local = context.Set<project>()
                //         .Local
                //         .FirstOrDefault(f => f.projectID == project.projectID);
                //if (local != null)
                //{
                //    context.Entry(local).State = EntityState.Detached;
                //}


                // Existing entity
                context.Entry(project).State = EntityState.Modified;
            }
        }