Exemple #1
0
        public ActionResult Create([FromBody] BookingViewModel vm)
        {
            var rt  = vm.ToBooking();
            var res = _bo.Create(rt);

            return(res.Success ? Ok() : InternalServerError());
        }
        public ActionResult Create([FromBody] BookingViewModel vm)
        {
            var b   = vm.ToBooking();
            var res = _bo.Create(b);

            return(StatusCode(res.Success ? (int)HttpStatusCode.OK : (int)HttpStatusCode.InternalServerError));
        }
        public void TestCreateBooking()
        {
            ContextSeeders.Seed();
            var crbo  = new ClientRecordBusinessObject();
            var bbo   = new BookingBusinessObject();
            var pbo   = new PersonBusinessObject();
            var rbo   = new RestaurantBusinessObject();
            var lhubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());
            var newP           = new Person(11111, 11111, "ok", "ok", DateTime.UtcNow, _lennyouseUser.Id);
            var newR           = new Restaurant("ok", "ok", "ok", "ok", "ok", 5);



            var cr      = new ClientRecord(DateTime.UtcNow, newP.Id, newR.Id);
            var booking = new Booking(cr.Id, DateTime.UtcNow);



            crbo.Create(cr);
            pbo.Create(newP);
            rbo.Create(newR);
            lhubo.Create(_lennyouseUser);

            var resCreate = bbo.Create(booking);
            var resGet    = bbo.Read(booking.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #4
0
        public ActionResult Create([FromBody] BookingViewModel vm)
        {
            var b = new Booking(vm.ClientRecordId, vm.Date);

            var res  = _bo.Create(b);
            var code = res.Success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError;

            return(new ObjectResult(code));
        }
        public void TestCreateAndReadBooking()
        {
            RestaurantSeeder.SeedCountries();
            var bo        = new BookingBusinessObject();
            var boForeign = new ClientRecordBusinessObject();

            var booking = new Booking(DateTime.Parse("2015/04/04"), boForeign.List().Result.First().Id);

            var resCreate = bo.Create(booking);
            var resGet    = bo.Read(booking.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public void TestCreateAndListBooking()
        {
            RestaurantSeeder.Seed();
            var cbo = new ClientRecordBusinessObject();
            var bbo = new BookingBusinessObject();

            var c = cbo.List().Result.First();

            var dr        = new Booking(DateTime.Now, c.Id);
            var resCreate = bbo.Create(dr);
            var resGet    = bbo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }