Пример #1
0
        public async Task <IActionResult> Details(string Id)
        {
            int decryptedId;
            int y;

            if (int.TryParse(Id, out y))
            {
                decryptedId = y;
            }
            else
            {
                decryptedId = Convert.ToInt32(protector.Unprotect(Id));
            }

            var leaveType = await leaveTypeService.GetLeaveType(decryptedId);

            if (leaveType == null)
            {
                return(View("NotFound", decryptedId));
            }
            if (Id == null)
            {
                return(RedirectToAction("Index"));
            }
            LeaveTypeDetailsViewModel leaveTypeDetailsViewModel = new LeaveTypeDetailsViewModel
            {
                LeaveType   = leaveType,
                EncryptedId = Id,
                PageTitle   = "LEAVETYPE DETAILS"
            };

            return(View(leaveTypeDetailsViewModel));
        }
Пример #2
0
        public async Task <IActionResult> LeaveTypeDetails(int LeaveTypeId)
        {
            try
            {
                var response = await _service.GetLeaveType(LeaveTypeId);

                if (response != null)
                {
                    return(Ok(response));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public ActionResult GetLeaveType()
 {
     return(Ok(_leaveTypeService.GetLeaveType(GetToken(HttpContext))));
 }