예제 #1
0
        public IHttpActionResult Get(int id)
        {
            GigService gigService = CreateGigService();
            var        gig        = gigService.GetGig(id);

            return(Ok(gig));
        }
예제 #2
0
        private GigService CreateGigService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new GigService(userId);

            return(service);
        }
예제 #3
0
        private GigService CreateGigService()
        {
            var userId     = User.Identity.GetUserId();
            var gigService = new GigService(userId);

            return(gigService);
        }
예제 #4
0
        // GET: api/Gigs
        // TODO: make async
        public IHttpActionResult GetGigs()
        {
            var gigService = new GigService();
            var gigs       = gigService.GetGigs();

            return(Ok(gigs));
        }
예제 #5
0
        // GET: Artist
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new GigService(userId);
            var model   = service.GetGigsByUser();

            return(View(model));
        }
예제 #6
0
        public IHttpActionResult DeleteGig(int id)
        {
            var gigService = new GigService();

            if (!gigService.DeleteGig(id))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
예제 #7
0
        public IHttpActionResult GetGig(int id)
        {
            var gigService = new GigService();
            var gig        = gigService.GetGigById(id);

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

            return(Ok(gig));
        }
예제 #8
0
        public void CreateServiceStepTwoTest1()
        {
            GigService gigService = new GigService(dbContext);
            Package    package    = new Package();

            package.Name           = "Basic";
            package.Description    = "Description";
            package.Title          = "Khong co kho";
            package.DeliveryTime   = 1;
            package.NumberRevision = 1;
            package.Price          = 50;
            package.ServiceId      = 1;
            Assert.True(gigService.CreateServiceStepTwo(package));
        }
예제 #9
0
        public IHttpActionResult PostGig(GigResource gig)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var gigService = new GigService();

            if (!gigService.CreateGig(gig))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
예제 #10
0
        protected void PbpDataSource_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            /* Get the Service */
            IUnityContainer container = (IUnityContainer)
                                        HttpContext.Current.Application["unityContainer"];

            // gigService is not resolved against the container because it
            // produce a proxy that it not available for databinding
            IGigService gigService = new GigService();

            gigService = (IGigService)
                         container.BuildUp(gigService.GetType(), gigService);

            e.ObjectInstance = gigService;
        }
예제 #11
0
        public IHttpActionResult PutGig(int id, GigUpdateResource gig)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var gigService = new GigService();

            if (!gigService.UpdateGig(id, gig))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
예제 #12
0
        public void CreateServiceStepOneTest1(string title, string category, string subcategory, string tags, int sellerId)
        {
            GigService gigService = new GigService(dbContext);

            Assert.NotNull(gigService.CreateServiceStepOne(title, category, subcategory, tags, sellerId));
        }
예제 #13
0
        public void GetPackageByPackageIDTest1(int?packageId)
        {
            GigService gigService = new GigService(dbContext);

            Assert.Null(gigService.GetPackageByPackageID(packageId));
        }
예제 #14
0
        public void GetListServiceTest1()
        {
            GigService gigService = new GigService(dbContext);

            Assert.Empty(gigService.GetListService());
        }
예제 #15
0
        public void GetPackageByServiceIDTest1(int?ServiceId)
        {
            GigService gigService = new GigService(dbContext);

            Assert.Empty(gigService.GetPackageByServiceID(ServiceId));
        }
예제 #16
0
        public void GetServiceByIDTest2(int?ID)
        {
            GigService gigService = new GigService(dbContext);

            Assert.Null(gigService.GetServiceByID(ID));
        }
예제 #17
0
        public void reportGigTest1()
        {
            GigService gigService = new GigService(dbContext);

            Assert.True(gigService.reportGig(1, 1, "dung de zai", "dung dep zai"));
        }
예제 #18
0
        public void CreateServiceStepThreeTest1()
        {
            GigService gigService = new GigService(dbContext);

            Assert.True(gigService.CreateServiceStepThree(1, "Dung dep zai", null, null));
        }
예제 #19
0
        public void GetUserByServiceIdTest1(int ServiceId)
        {
            GigService gigService = new GigService(dbContext);

            Assert.Null(gigService.GetUserByServiceId(ServiceId));
        }