Exemple #1
0
        public void TestCreateStaffRecord()
        {
            ContextSeeders.Seed();
            var srbo = new StaffRecordBusinessObject();
            var pbo  = new PersonBusinessObject();
            var rbo  = new RestaurantBusinessObject();
            var lubo = new LennyouseUserBusinessObject();

            var _lennyouseUser = new LennyouseUser(Guid.NewGuid());

            lubo.Create(_lennyouseUser);

            var _person = new Person(1234321, 23432456, "Marco", "Figueirnha", DateTime.UtcNow, _lennyouseUser.Id);

            pbo.Create(_person);

            var _restaurant = new Restaurant("Tasca do sol", "Bairro Alto 2", "12h", "00h", "Mondays", 3);

            rbo.Create(_restaurant);

            var _staffRecord = new StaffRecord(DateTime.UtcNow, DateTime.UtcNow, _person.Id, _restaurant.Id);

            var resCreate = srbo.Create(_staffRecord);
            var resGet    = srbo.Read(_staffRecord.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
        public ActionResult <StaffRecordViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var srvm = StaffRecordViewModel.Parse(res.Result);
                return(srvm);
            }
            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
        public void TestCreateAndReadClientRecord()
        {
            RestaurantSeeder.SeedCountries();
            var bo           = new StaffRecordBusinessObject();
            var bop          = new PersonBusinessObject();
            var personId     = bop.List().Result.First();
            var bor          = new RestaurantBusinessObject();
            var restaurantId = bor.List().Result.First();
            var dr           = new StaffRecord(DateTime.Parse("2020/05/05"), DateTime.Parse("2020/06/06"), personId.Id, restaurantId.Id);
            var resCreate    = bo.Create(dr);
            var resGet       = bo.Read(dr.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Exemple #4
0
        public void TestCreateAndListStaffRecord()
        {
            RestaurantSeeder.Seed();
            var sbo = new StaffRecordBusinessObject();
            var rbo = new RestaurantBusinessObject();
            var pbo = new PersonBusinessObject();

            var r = rbo.List().Result.First();
            var p = pbo.List().Result.First();


            var dr        = new StaffRecord(p.Id, r.Id, DateTime.Now, DateTime.Now);
            var resCreate = sbo.Create(dr);
            var resGet    = sbo.Read(dr.Id);

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