Dear Team,
I have a project on .NET Core MVC Web API with EntityFramewok and MySQL as back-end.
[ApiController]
[ServiceFilter(typeof(CustomAuthorization))]
public class QuestionMasterController : ControllerBase
{
private ConfigServerData configServer;
public QuestionMasterController(IOptionsSnapshot<ConfigServerData> config)
configServer = config.Value;
if (!string.IsNullOrEmpty(configServer.Database))
Startup.ConnectionString = configServer.Database;
}
[Route("AddAdminQuestionMaster")]
[HttpPost]
public IActionResult Add(AddCPQuestionMasterModel ReqQuestionMaster)
Response responseAdd = new Response();
try
responseAdd.Message = new DAL.CPQuestionMaster(configServer,Request).AddMainQuestion(ReqQuestionMaster);
responseAdd.Code = (int)HttpStatusCode.OK;
catch (Exception ex)
throw new CustomException(ex.Message, ex);
return StatusCode(responseAdd.Code, responseAdd);