コード例 #1
0
        public async Task <MainScreenResponse> AddScreen(ScreenRequest screenRequest)
        {
            var screen = _mapper.Map <Screens>(screenRequest);

            try
            {
                var isExist = _screenRepository.GetScreenByIdAndName(screenRequest);
                if (screen.ScreensId == 0 && isExist.Result == null)
                {
                    screen.CreatedBy = screenRequest.UserId.ToString();
                    var dataRole = await _screenRepository.AddAsync(screen);
                }
                else
                {
                    _response.Message = Constants.Screen_Already_Exists;
                    _response.Status  = false; return(_response);
                }
                _response.Message = Constants.Screen_Created_Success;
                _response.Status  = true;
            }
            catch (Exception)
            {
                _response.Status  = false;
                _response.Message = Constants.DEFAULT_ERROR_MSG;
            }
            return(_response);
        }