public HttpResponseMessage Query([FromBody] JournalQuery oQuery)
        {
            JournalQueryOperationList oResult;

            try
            {
                if (oQuery != null && !string.IsNullOrEmpty(oQuery.Id))
                {
                    oResult = JournalAccess.GetJournal(oQuery.Id);

                    return(Request.CreateResponse(HttpStatusCode.OK, oResult));
                }
                // In other case input is not valid
                else
                {
                    HttpError err = new HttpError("An invalid request has been received. This may mean the HTTP requests and/or the HTTP body may contains some errors which should be fixed.");
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, err));
                }
            }
            catch (Exception ex)
            {
                // TODO: This exception should be logged somewhere
                // If something happens throws Internal Error
                HttpError err = new HttpError("An unexpected error condition was triggered which made impossible to fulfill the request. Please try again or contact support.");
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, err));
            }
        }
Example #2
0
 public Students(string fn, string ln)
 {
     Firstname = fn;
     Lastname  = ln;
     group     = 0;//if group == 0, this student without group
     journal   = new JournalAccess();
 }
Example #3
0
 public Students(string fn, string ln, Groups grp, JournalAccess jour)
 {
     Firstname = fn;
     Lastname  = ln;
     grp.AddStudent(new Students(fn, ln));
     group   = grp.indGroup;
     journal = jour;
 }
Example #4
0
 public static void saveToJournal(string sTrackingId, IOperation oOperacion, IOperationResult oResult)
 {
     JournalAccess.SetJournal(sTrackingId, oOperacion, oResult);
 }