コード例 #1
0
ファイル: ShackUpService.cs プロジェクト: wesimon01/ShackUp
 public ShackUpService()
 {
     statesRepo        = StatesRepositoryFactory.GetRepository();
     bathroomTypesRepo = BathroomTypesRepositoryFactory.GetRepository();
     listingsRepo      = ListingRepositoryFactory.GetRepository();
     acctRepo          = AccountRepositoryFactory.GetRepository();
 }
コード例 #2
0
        public ActionResult Contacts()
        {
            var userId = AuthorizeUtilities.GetUserId(this);

            var repo  = AccountRepositoryFactory.GetRepository();
            var model = repo.GetContacts(userId);

            return(View(model));
        }
コード例 #3
0
        public ActionResult DeleteFavorite(int ListingId)
        {
            var userId = AuthorizeUtilities.GetUserId(this);

            var repo = AccountRepositoryFactory.GetRepository();

            repo.RemoveFavorite(userId, ListingId);

            return(RedirectToAction("Favorites"));
        }
コード例 #4
0
        public IHttpActionResult RemoveContact(string userId, int listingId)
        {
            var repo = AccountRepositoryFactory.GetRepository();

            try
            {
                repo.RemoveContact(userId, listingId);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #5
0
        public IHttpActionResult CheckFavorite(string userId, int listingId)
        {
            var repo = AccountRepositoryFactory.GetRepository();

            try
            {
                var result = repo.IsFavorite(userId, listingId);
                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #6
0
        public ActionResult UserList()
        {
            var model = AccountRepositoryFactory.GetRepository().GetUsers().ToList();

            return(View(model));
        }
コード例 #7
0
 public ActionResult Contact(Contacts contacts)
 {
     AccountRepositoryFactory.GetRepository().AddContact(contacts);
     return(View());
 }
コード例 #8
0
 public MyAccountController()
 {
     _svc     = ShackUpServiceFactory.GetService();
     acctRepo = AccountRepositoryFactory.GetRepository(); //use if no service layer
 }
コード例 #9
0
 public ListingsAPIController()
 {
     _svc        = ShackUpServiceFactory.GetService();
     acctRepo    = AccountRepositoryFactory.GetRepository(); //use if no service layer
     listingRepo = ListingRepositoryFactory.GetRepository(); //use if no service layer
 }