public ActionResult <StaffTitleViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var stvm = StaffTitleViewModel.Parse(res.Result);
                return(stvm);
            }
            else
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
        }
Пример #2
0
        public ActionResult <StaffTitleViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = StaffTitleViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(InternalServerError());
            }
        }
Пример #3
0
        public void TestCreateAndReadStaffTitle()
        {
            RestaurantSeeder.SeedCountries();
            var stbo      = new StaffTitleBusinessObject();
            var tbo       = new TitleBusinessObject();
            var tl        = tbo.List().Result.First();
            var sbo       = new StaffRecordBusinessObject();
            var sr        = sbo.List().Result.First();
            var st        = new StaffTitle(DateTime.Parse("2015/05/05"), DateTime.Parse("2020/05/05"), tl.Id, sr.Id);
            var resCreate = stbo.Create(st);
            var resGet    = stbo.Read(st.Id);

            Assert.IsTrue(resCreate.Success && resGet.Success && resGet.Result != null);
        }
Пример #4
0
        public void TestCreateAndListStaffTitle()
        {
            RestaurantSeeder.Seed();
            var sbo  = new StaffTitleBusinessObject();
            var tbo  = new TitleBusinessObject();
            var srbo = new StaffRecordBusinessObject();

            var t  = tbo.List().Result.First();
            var sr = srbo.List().Result.First();


            var dr        = new StaffTitle(DateTime.Now, DateTime.Now, sr.Id, t.Id);
            var resCreate = sbo.Create(dr);
            var resGet    = sbo.Read(dr.Id);

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