Beispiel #1
0
        // POST: api/Login
        public Response Post([FromBody] T_Users data)
        {
            List <T_Users> user = dalobj.T_Users.ToList();

            if ((data.EmailId != null && data.Password != null))
            {
                var validUser = (from u in user
                                 where u.EmailId == data.EmailId && u.Password == data.Password
                                 select u).SingleOrDefault();
                if (validUser != null)
                {
                    response.Status = "success";
                    response.Err    = null;
                    response.Data   = validUser;
                    logger.Log("Login Successfull.");
                }
                else
                {
                    response.Status = "failed! Invalid Credentials";
                    response.Err    = null;
                    response.Data   = null;
                    logger.Log("Login Failed!");
                }

                return(response);
            }
            else
            {
                response.Status = "Plz enter Credentials";
                response.Err    = null;
                return(response);
            }
        }
Beispiel #2
0
 // GET: api/Admin
 public Response GetUsersList()
 {
     response.Data   = dalObj.T_Users.ToList();
     response.Status = "Success";
     logger.Log("Displayed User list to admin");
     return(response);
 }
Beispiel #3
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            string msgformat  = "/{0}/{1} method is called";
            string Controller = actionContext.ActionDescriptor.ControllerDescriptor.ControllerName;
            string method     = actionContext.ActionDescriptor.ActionName;

            string msg = string.Format(msgformat, Controller, method);

            logger.Log(msg);
        }
        public Response Get()
        {
            List <T_Roles> roles = dalObj.T_Roles.ToList();

            response.Data   = roles;
            response.Status = "Success";
            response.Error  = null;
            logger.Log("List displayed for roles");
            return(response);
        }
        // GET: api/Users
        public Response Get()
        {
            List <T_Users> users = dalObj.T_Users.ToList();

            response.Data   = users;
            response.Status = "Success";
            response.Error  = null;
            logger.Log("List displayed for Users");
            return(response);
        }
Beispiel #6
0
        // GET: api/Users
        public Response Get()
        {
            List <T_Users> list = dalobj.T_Users.ToList();

            response.Data   = list;
            response.Status = "success";
            response.Err    = null;
            logger.Log("User List Displayed");
            return(response);
        }
Beispiel #7
0
        // GET: api/Roles
        public Response Get()
        {
            List <T_Roles> ro = dalobj.T_Roles.ToList();

            response.Data   = ro;
            response.Status = "Success";
            response.Err    = null;
            logger.Log("Diaplayed Roles");
            return(response);
        }
Beispiel #8
0
 static void Main(string[] args)
 {
     MyLoggerLib.ILogger logger = MyLoggerLib.LoggerFactory.GetLogger(1);
     logger.Log("yahoo");
 }
Beispiel #9
0
 // GET: api/Subject
 public Response Get()
 {
     try
     {
         List <T_Subject> list = dalobj.T_Subject.ToList();
         response.Data   = list;
         response.Status = "success";
         response.Err    = null;
         logger.Log("Subject list displayed");
         return(response);
     }
     catch (Exception cause)
     {
         response.Data   = cause.Message;
         response.Status = "Failed";
         response.Err    = cause;
         logger.Log("Exception occured returned Error msg");
         return(response);
     }
 }
        // GET: api/AFeedback
        public Response Get1()
        {
            try
            {
                List <T_Feedback> feedbacks = dalobj.T_Feedback.ToList();
                List <T_Users>    users     = dalobj.T_Users.ToList();

                //var output = (from fd in feedbacks
                //              join u in users on fd.UserId_ equals u.UserId
                //              select new { fd, u.Name });

                var list = (from u in users
                            join fdbk in feedbacks on u.UserId equals fdbk.UserId_
                            select fdbk).ToList();


                response.Data   = list;
                response.Status = "success";
                response.Err    = null;
                logger.Log("Feedback list displayed");
                return(response);
            }
            catch (Exception cause)
            {
                response.Data   = cause.Message;
                response.Status = "Failed";
                response.Err    = cause;
                logger.Log("Exception occured returned Error msg");
                return(response);
            }
        }
Beispiel #11
0
        // GET: api/Results
        public Response Get()
        {
            try
            {
                List <T_Result>  resList = dalobj.T_Result.ToList();
                List <T_Subject> subList = dalobj.T_Subject.ToList();
                List <T_Users>   uList   = dalobj.T_Users.ToList();
                var list = (from res in resList
                            join u in uList on res.UserId equals u.UserId
                            join sub in subList on res.SubId equals sub.SubId
                            select new
                {
                    u.Name,
                    u.EmailId,
                    sub.SubName,
                    u.IsLocked,
                    res.CntCorrectAns
                }).ToList();

                response.Data   = list;
                response.Status = "success";
                response.Err    = null;
                logger.Log("Result list displayed");
                return(response);
            }
            catch (Exception cause)
            {
                response.Data   = cause.Message;
                response.Status = "Failed";
                response.Err    = cause;
                logger.Log("Exception occured returned Error msg");
                return(response);
            }
        }
Beispiel #12
0
 // GET: api/Question
 public Response Get()
 {
     try
     {
         List <T_Question> list = dalobj.T_Question.ToList();
         if (list != null)
         {
             response.Data   = list;
             response.Status = "success";
             response.Err    = null;
             logger.Log("List of Questions displayed");
             return(response);
         }
         else
         {
             response.Data   = null;
             response.Status = "failed";
             response.Err    = null;
             logger.Log("List of Questions is Empty");
             return(response);
         }
     }
     catch (Exception cause)
     {
         response.Data   = cause.Message;
         response.Status = "Failed";
         response.Err    = cause;
         logger.Log("Exception occured returned Error msg");
         return(response);
     }
 }