Beispiel #1
0
        public HttpResponseMessage GetAllMovies()
        {
            log.Error(string.Format("Start action controller"));
            List <PicturesDTO> list = new List <PicturesDTO>();

            try {
                if (WebConfigurationManager.AppSettings["dataOrigen"].ToString() == "DB")
                {
                    log.Error(string.Format("getting data from DB"));
                    var data = new DataAccess();
                    list = JsonConvert.DeserializeObject <List <PicturesDTO> >(data.GetPictures());
                    return(Request.CreateResponse(HttpStatusCode.OK, list));
                }
                else
                {
                    log.Error(string.Format("getting mock data"));
                    var data = new MockData.MockData();
                    list = data.GetMovies();
                    log.Error(string.Format("Everything was just fine..."));
                    return(Request.CreateResponse(HttpStatusCode.OK, list));
                }
            }

            catch (Exception ex) {
                log.Error(string.Format("Something went wrong {0}", ex));
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, list));
            }
        }
Beispiel #2
0
 public ActionResult Index(UserInfo _user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // throw new Exception();
             MockData.MockData md = MockData.MockData.GetMockData();
             if (md.AddData(_user))
             {
                 return(RedirectToAction("Index", "Login"));
             }
             else
             {
                 ViewBag.error = "This email address is already in use. If you’ve forgoten your password click  <a href=\"/Retrieve\">here</a> to retrieve it.";
                 return(View());
             }
         }
         return(View());
     }
     catch
     {
         TempData["errormsg"] = "We’re sorry but we were unable to create your account at this time. Please try.";
         return(RedirectToAction("Index", "Error"));
     }
 }
Beispiel #3
0
 public ActionResult Index(string email, string password)
 {
     MockData.MockData md = MockData.MockData.GetMockData();
     if (md.GetPassword(email) == password)
     {
         Session["UserName"] = email;
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(RedirectToAction("LoginError", "Home"));
     }
 }
        public ViewLocalEventsModel(DBGenericService <LocalEvent> service)
        {
            Service = service;

            if (Service.GetObjectsAsync().Result.ToList().Count <= 0)
            {
                MockData.MockData mockData = new MockData.MockData();
                foreach (var obj in mockData.GetEvents())
                {
                    Service.AddObjectAsync(obj);
                }
            }

            Events = Service.GetObjectsAsync().Result.ToList();
        }