public ActionResult <List <BookingViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
            var list = new List <BookingViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(BookingViewModel.Parse(item));
            }
            return(list);
        }
Exemplo n.º 2
0
        public ActionResult <List <BookingViewModel> > ListUndeleted()
        {
            var res = _bo.ListUnDeleted();

            if (!res.Success)
            {
                return(InternalServerError());
            }

            var list = new List <BookingViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(BookingViewModel.Parse(item));
            }

            return(list);
        }
        public ActionResult <BookingViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var bvm = BookingViewModel.Parse(res.Result);
                return(bvm);
            }
            else
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError));
            }
        }
Exemplo n.º 4
0
        public ActionResult <BookingViewModel> Get(Guid id)
        {
            var res = _bo.Read(id);

            if (res.Success)
            {
                if (res.Result == null)
                {
                    return(NotFound());
                }
                var vm = BookingViewModel.Parse(res.Result);
                return(vm);
            }
            else
            {
                return(InternalServerError());
            }
        }
        public async Task <IActionResult> GetAsync(Guid id)
        {
            var getResult = await _bo.ReadAsync(id);

            if (!getResult.Success)
            {
                return(InternalServerError(getResult.Exception));
            }
            var item = getResult.Result;

            if (item == null)
            {
                return(NotFound());
            }
            var vm = BookingViewModel.Parse(item);

            return(Ok(vm));
        }
        public async Task <IActionResult> ListAsync()
        {
            var listResult = await _bo.ListNonDeletedAsync();

            if (!listResult.Success)
            {
                return(InternalServerError(listResult.Exception));
            }
            var list = listResult.Result;
            var lst  = new List <BookingViewModel>();

            foreach (var item in list)
            {
                var vm = BookingViewModel.Parse(item);
                lst.Add(vm);
            }
            return(Ok(lst));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var getOperation = await _bo.ReadAsync((Guid)id);

            if (!getOperation.Success)
            {
                return(View("Error", getOperation.Exception.Message));
            }
            if (getOperation.Result == null)
            {
                return(NotFound());
            }
            var vm = BookingViewModel.Parse(getOperation.Result);

            ViewData["Header"] = "Booking";
            return(View(vm));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Index()
        {
            var listOperation = await _bo.ListNonDeletedAsync();

            if (!listOperation.Success)
            {
                return(View("Error", new ErrorViewModel()
                {
                    RequestId = listOperation.Exception.Message
                }));
            }
            var lst = new List <BookingViewModel>();

            foreach (var item in listOperation.Result)
            {
                lst.Add(BookingViewModel.Parse(item));
            }
            ViewData["Header"] = "Bookings";

            return(View(lst));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var getOperation = await _bo.ReadAsync((Guid)id);

            if (!getOperation.Success)
            {
                return(View("Error", new ErrorViewModel()
                {
                    RequestId = getOperation.Exception.Message
                }));
            }
            if (getOperation.Result == null)
            {
                return(NotFound());
            }
            var vm = BookingViewModel.Parse(getOperation.Result);

            return(View(vm));
        }