예제 #1
0
        public async Task <IActionResult> AddRole(Roles role, CancellationToken cancellationToken)
        {
            try
            {
                //Roles role = new Roles()
                //{
                //    RoleName = rolename,
                //    CreatedBy = "Basha",
                //    ModifiedBy = "Basha",
                //    CreatedDate = DateTime.Now,
                //    ModifiedDate = DateTime.Now
                //};

                await _repo.AddRole(role, cancellationToken);

                return(Ok("Role added successfully"));
            }
            catch (Exception ex)
            {
                await _errorlogService.InsertError(Request.GetDisplayUrl(), ControllerContext.ActionDescriptor.ActionName.ToString(), ex.Message, ex.ToString()).ConfigureAwait(false);

                return(StatusCode(500, ex.InnerException));
            }
        }