public ActionResult Create([FromBody] StaffRecordViewModel vm)
        {
            var p   = vm.ToStaffRecord();
            var res = _bo.Create(p);

            return(StatusCode(res.Success ? (int)HttpStatusCode.OK : (int)HttpStatusCode.InternalServerError));
        }
Exemplo n.º 2
0
        public ActionResult Create([FromBody] StaffRecordViewModel vm)
        {
            var rt  = vm.ToStaff();
            var res = _bo.Create(rt);

            return(res.Success ? Ok() : InternalServerError());
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public ActionResult Create([FromBody] StaffRecordViewModel vm)
        {
            var sr = new StaffRecord(vm.BeginDate, vm.EndDate, vm.PersonId, vm.RestaurantId);

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

            return(new ObjectResult(code));
        }
        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);
        }
Exemplo n.º 6
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);
        }