Exemplo n.º 1
0
        public async Task <ObjectResult> CreateConsumerBusiness(Consumer consumer)
        {
            try {
                _log4net.Info(" Http GET in controller is accesed");
                if (!ModelState.IsValid)
                {
                    return(new BadRequestObjectResult(ModelState));
                }
                var Result = await repository.CreateConsumerBussiness(consumer);

                _log4net.Info("method execution in controller completed");
                if (!Result)
                {
                    return(new ObjectResult("Database error")
                    {
                        StatusCode = 500
                    });
                }
                return(new CreatedResult("FindConsumerBussiness", new { id = consumer.id }));
            }
            catch (Exception e)
            {
                _log4net.Error("Error in getting the consumerController with respective Id" + " As " + e.Message);
                return(new ObjectResult("Database error")
                {
                    StatusCode = 500
                });
            }
        }