Example #1
0
        public ActionResult Create(FormCollection scope)
        {
            if (scope.Count != 0)
            {
                DateTime beginDate = Convert.ToDateTime(scope["beginDate"]);
                DateTime endDate   = Convert.ToDateTime(scope["endDate"]);
                TimeSpan span      = endDate.Subtract(beginDate);
                int      dayDiff   = span.Days + 1;


                teach teachItem = new teach();
                teachItem.teach_date    = Convert.ToDateTime(scope["teachDate"]);
                teachItem.weekDay       = scope["teachWeekDay"];
                teachItem.teach_time    = scope["teach_time"];
                teachItem.activity_name = scope["activity_name"];
                teachItem.learner       = scope["learner"];
                teachItem.supervisor    = scope["teacher"];
                teachItem.location      = scope["location"];
                db.teaches.Add(teachItem);
                db.SaveChanges();

                var teachList = db.teaches
                                .Where(c => (c.teach_date.Value.Month >= DateTime.Today.Month))
                                .OrderByDescending(c => c.teach_date).ToList();
                return(View(teachList));
            }
            return(View());
        }
Example #2
0
        public ActionResult DeleteConfirmed(long id)
        {
            teach teach = db.teaches.Find(id);

            db.teaches.Remove(teach);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "id,teach_date,weekDay,teach_time,activity_name,learner,supervisor,location")] teach teach)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teach).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(teach));
 }
Example #4
0
        // GET: GSTeach/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            teach teach = db.teaches.Find(id);

            if (teach == null)
            {
                return(HttpNotFound());
            }
            return(View(teach));
        }
Example #5
0
    public void book()
    {
        ChatText.text += main_script.my_name;
        ChatText.text += "獲得新靈感\n";
        GameObject teach_obj    = GameObject.Find("/UI/Button/教育");
        teach      teach_script = teach_obj.GetComponent <teach>();

        teach_script.nowHP += 20;

        GameObject          src_obj    = GameObject.Find("Pet");
        pet_controll_script src_script = src_obj.GetComponent <pet_controll_script>();

        src_script.check_ac();
        ++src_script.cnt;
    }
Example #6
0
 private void Awake()
 {
     t = GameObject.FindObjectOfType <teach>();
 }