Exemplo n.º 1
0
        public JsonResult UpdateSchoolSession(SchoolSession session)
        {
            if (session.SessionL == null)
            {
                return(Json(new { msg = "0", Reason = "Update Failed, Session field is required!" }));
            }
            if (session.YearL == null)
            {
                return(Json(new { msg = "0", Reason = "Update Failed, Year field is required!" }));
            }
            if (session.Term == null)
            {
                return(Json(new { msg = "0", Reason = "Update Failed, Term field is required!" }));
            }
            if (session.SchoolStart == null)
            {
                return(Json(new { msg = "0", Reason = "Update Failed, School Start field is required!" }));
            }
            if (session.SchoolEnd == null)
            {
                return(Json(new { msg = "0", Reason = "Update Failed, School End field is required!" }));
            }

            _sessionRepo = new SchoolSessionRepository();
            int _i = _sessionRepo.Update(session);

            if (_i > 0)
            {
                return(Json(new { msg = "1", Reason = "Update Successfull!" }));
            }
            return(Json(new { msg = "0", Reason = "Update Failed!" }));
        }