Пример #1
0
        public IHttpActionResult GetLogWithID([FromUri] int LogID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                LogService logService = new LogService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                logService.Query = logService.FillQuery(typeof(Log), lang, 0, 1, "", "", extra);

                if (logService.Query.Extra == "A")
                {
                    LogExtraA logExtraA = new LogExtraA();
                    logExtraA = logService.GetLogExtraAWithLogID(LogID);

                    if (logExtraA == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(logExtraA));
                }
                else if (logService.Query.Extra == "B")
                {
                    LogExtraB logExtraB = new LogExtraB();
                    logExtraB = logService.GetLogExtraBWithLogID(LogID);

                    if (logExtraB == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(logExtraB));
                }
                else
                {
                    Log log = new Log();
                    log = logService.GetLogWithLogID(LogID);

                    if (log == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(log));
                }
            }
        }
Пример #2
0
 public LogTest()
 {
     log       = new Log();
     logExtraA = new LogExtraA();
     logExtraB = new LogExtraB();
 }