コード例 #1
0
        public ActionResult SLeaveRequests(LeaveViewModel collection)
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            LeavesRequest request = new LeavesRequest();

            request.Reason    = collection.Reason;
            request.Date      = DateTime.Now;
            request.StudentId = LoginClass.LoginId;

            db.LeavesRequests.Add(request);
            db.SaveChanges();

            return(View());
        }
コード例 #2
0
        public ActionResult PLeaveRequests(LeaveViewModel collection)
        {
            DBSmartSchoolWebPortalEntities111 db = new DBSmartSchoolWebPortalEntities111();
            LeavesRequest request = new LeavesRequest();
            var           Parent  = db.Parents.Where(x => x.Id == LoginClass.LoginId).First();
            var           Student = db.Students.Where(x => x.Id == Parent.StudentId).First();

            request.Reason    = collection.Reason;
            request.Date      = DateTime.Now;
            request.StudentId = Student.Id;

            db.LeavesRequests.Add(request);
            db.SaveChanges();

            return(View());
        }