public async Task <IActionResult> Create([FromBody] Icc icc)
        {
            ServiceResponse <Icc> serviceResponse = new ServiceResponse <Icc>();

            if (icc == null)
            {
                _logger.LogError("schedule object sent from client is null.");
                serviceResponse.IsSuccess = false;
                serviceResponse.Message   = "schedule object sent from client is null";
                return(BadRequest(serviceResponse));
            }

            if (!ModelState.IsValid)
            {
                _logger.LogError("Invalid schedule object sent from client.");
                serviceResponse.IsSuccess = false;
                serviceResponse.Message   = "Invalid schedule object sent from client.";
                return(BadRequest(serviceResponse));
            }
            serviceResponse = await _IempService.CreateIccEmp(icc);

            if (serviceResponse == null)
            {
                return(BadRequest(serviceResponse));
            }

            serviceResponse.Message = "Icc Employee Successfully Created";
            return(Ok(serviceResponse));
        }
Example #2
0
 protected override void Load(ContainerBuilder builder)
 {
     builder.RegisterType <XmlSerializer>();
     builder.Register <StorageSerializer>(Icc =>
     {
         return(new StorageSerializer(Icc.Resolve <XmlSerializer>(), _storageLocationPath));
     });
     builder.RegisterType <MainViewModel>().SingleInstance();
 }
Example #3
0
 public HttpResponseMessage GetIFValues(string country, string env, string pipeline)
 {
     try
     {
         var values = Icc.GetPipelineValues(country, env, pipeline);
         return(this.Request.CreateResponse(HttpStatusCode.Created, values));
     }
     catch (Exception ex)
     {
         return(this.Request.CreateResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Example #4
0
        public async Task <ServiceResponse <Icc> > CreateIccEmp(Icc icc)
        {
            ServiceResponse <Icc> serviceResponse = new ServiceResponse <Icc>();

            try
            {
                //  Complaint complaint1 = new Complaint();
                //we can use AutoMapper here
                //   Complaint sc = _mapper.Map<Complaint>(complaint1);
                serviceResponse.Data = await _empRepository.AddData(icc);

                serviceResponse.Message = "Icc Employee Created";
            }
            catch (Exception ex)
            {
                serviceResponse.IsSuccess = false;
                serviceResponse.Message   = ex.Message;
                _logger.LogError($"Something went wrong inside CreateSchedule action: {ex.Message}");
            }

            return(serviceResponse);
        }