Example #1
0
        public async Task <IActionResult> CreateUser([FromBody] VW_UserDetail vw_UserDetail)
        {
            var Transaction = _repo.BeginTrainsaction();

            try
            {
                await _repo.userCreationCRUD.CreateUser(vw_UserDetail);

                vw_UserDetail.UserMstID = _repo.userCreationCRUD.MaxUserMstID().Result;
                await _repo.vsecLoginMst.CreatLogin(vw_UserDetail);

                Transaction.Commit();

                return(CreatedAtRoute("UserById", new { id = vw_UserDetail.UserMstID }, vw_UserDetail));
            }
            catch (Exception ex)
            {
                Transaction.Rollback();
                _logger.LogError($"Something went wrong inside CreateUser action: {ex.Message}");
                return(StatusCode(500, "Internal server error"));
            }
            finally
            {
                Transaction.Dispose();
            }
        }