public static DynamicParameters CreateTemplateCopyRequest(CopyTemplate request, string userName) { DynamicParameters param = new DynamicParameters(); param.Add(Constants.StoredProcedureParameters.TemplateId, request.TemplateId); param.Add(Constants.StoredProcedureParameters.TemplateName, request.TemplateName); param.Add(Constants.StoredProcedureParameters.CreatedBy, userName); return(param); }
public async Task <IActionResult> CreateTemplateCopy([FromBody] CopyTemplate request) { var result = new BaseResult <long> { Result = 123L }; var templateCopy = await iTemplate.CreateTemplateCopy(request, base.LoggedInUserName).ConfigureAwait(false); if (templateCopy.IsError && templateCopy.ExceptionMessage != null) { return(new StatusCodeResult(500)); } else if (templateCopy.Result == null) { return(NoContent()); //204 } return(Ok(templateCopy)); }
public async Task <BaseResult <Field> > CreateTemplateCopy(CopyTemplate request, string userName) { BaseResult <List <Field> > templateList = new BaseResult <List <Field> >(); DynamicParameters paramCollection = ContractTemplateRequestMapper.CreateTemplateCopyRequest(request, userName); templateList = await iTemplate.ExecuteStoredProcedure(Constants.StoredProcedure.CreateTemplateCopy, paramCollection).ConfigureAwait(false); if (templateList != null) { BaseResult <Field> copiedtemplate = new BaseResult <Field> { IsError = templateList.IsError, ExceptionMessage = templateList.ExceptionMessage }; if (templateList.Result != null && templateList.Result.Any()) { copiedtemplate.Result = templateList.Result[0]; } return(copiedtemplate); } return(null); }