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

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

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

            if (!res.Success)
            {
                return(InternalServerError());
            }
            var list = new List <StaffRecordViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(StaffRecordViewModel.Parse(item));
            }
            return(list);
        }
        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));
            }
        }
Esempio n. 4
0
        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 = StaffRecordViewModel.Parse(item);

            return(Ok(vm));
        }
Esempio n. 5
0
        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 <StaffRecordViewModel>();

            foreach (var item in list)
            {
                var vm = StaffRecordViewModel.Parse(item);
                lst.Add(vm);
            }
            return(Ok(lst));
        }
Esempio n. 6
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 <StaffRecordViewModel>();

            foreach (var item in listOperation.Result)
            {
                lst.Add(StaffRecordViewModel.Parse(item));
            }
            ViewData["Header"] = "StaffRecords";
            return(View(lst));
        }
Esempio 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 = StaffRecordViewModel.Parse(getOperation.Result);

            ViewData["Header"] = "StaffRecord";
            return(View(vm));
        }
Esempio n. 8
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 = StaffRecordViewModel.Parse(getOperation.Result);

            return(View(vm));
        }