public virtual async Task <IActionResult> Get() { try { BaseResult <List <T> > result = await _iMasterData.GetList(); if (result.IsError || result.ExceptionMessage != null) { LogHelper.LogInformation(_iLogger, Constants.AppName, "Get", "Error Occurred. " + result.ExceptionMessage.Message.ToString(), this._className); return(new StatusCodeResult(500)); } if (result.Result == null || result.Result.Count == 0) { return(NoContent()); //204 } return(Ok(result)); } catch (Exception ex) { Dictionary <string, string> inputParameter = new Dictionary <string, string>(); LogHelper.LogError(_iLogger, Constants.AppName, "Get", "Error Occurred. ", this._className, ex, Constants.InternalErrorStatusCode, null); return(new StatusCodeResult(500)); } }
public override async Task <IActionResult> Create([FromBody] Models.Request.RevenueMarkup model) { try { if (model == null || model.MGRevenueMarkup == null || model.RevenueMarkupRules.Count <= 0) { return(new BadRequestObjectResult(model)); } else { var exisitingRuleList = await _iMarkupDataRevenueMarkupRule.GetList(); if (exisitingRuleList.IsError == true || exisitingRuleList.ExceptionMessage != null) { LogHelper.LogInformation(_iLogger, Constants.AppName, "Create", "Error Occurred. " + exisitingRuleList.ExceptionMessage.Message.ToString(), this._className); return(new StatusCodeResult(500)); } exisitingRevenueMarkupRuleList = exisitingRuleList.Result; var exisisitngRevenueMarkup = await _iMasterDataRevenueMarkup.GetList(); if (exisisitngRevenueMarkup.IsError == true || exisisitngRevenueMarkup.ExceptionMessage != null) { LogHelper.LogInformation(_iLogger, Constants.AppName, "Create", "Error Occurred. " + exisitingRuleList.ExceptionMessage.Message.ToString(), this._className); return(new StatusCodeResult(500)); } BaseResult <Core.Model.Markup.RevenueMarkupRule> result = VaildateRequest(model, exisisitngRevenueMarkup); if (result.IsError || result.ExceptionMessage != null) { return(new BadRequestObjectResult(result)); } base.StoreProcedure = Constants.StoredProcedure.InsertRevenueMarkupRules; return(await base.Create(model)); } } catch (Exception ex) { Dictionary <string, string> inputParameter = new Dictionary <string, string>(); inputParameter.Add(key: "model", value: JsonConvert.SerializeObject(model)); LogHelper.LogError(_iLogger, Constants.AppName, "Create", "Error Occurred. " + ex.Message.ToString(), this._className, ex, null, inputParameter); return(new StatusCodeResult(500)); } }