public IActionResult Manage([FromBody] Entity.CompanyConfig company)
 {
     try
     {
         return(Ok(_companyConfigService.Manage(company)));
     }
     catch (Exception ex)
     {
         base.LogException(ex);
         return(null);
     }
 }
コード例 #2
0
        public Entity.ActionStatus Manage(Entity.CompanyConfig companyConfig)
        {
            try
            {
                var dbCompanyConfig = Mapper.Configuration.Mapper.Map <Entity.CompanyConfig, Model.CompanyConfig>(companyConfig);
                Entity.ActionStatus actionStatus = null;
                if (dbCompanyConfig.Guid == Guid.Empty)
                {
                    dbCompanyConfig.CompanyGuid = component.helper.SolutionConfiguration.CompanyId;
                    dbCompanyConfig.Guid        = Guid.NewGuid();
                    dbCompanyConfig.CreatedDate = DateTime.Now;
                    dbCompanyConfig.CreatedBy   = component.helper.SolutionConfiguration.CurrentUserId;
                    actionStatus = _companyConfigRepository.Insert(dbCompanyConfig);
                }
                else
                {
                    var olddbCompanyConfig = _companyConfigRepository.GetByUniqueId(x => x.Guid == dbCompanyConfig.Guid);
                    if (olddbCompanyConfig == null)
                    {
                        throw new NotFoundCustomException($"{CommonException.Name.NoRecordsFound} : CompanyConfig");
                    }

                    dbCompanyConfig.CreatedDate = olddbCompanyConfig.CreatedDate;
                    dbCompanyConfig.CreatedBy   = olddbCompanyConfig.CreatedBy; //TODO: Need To change later with session userid
                    dbCompanyConfig.UpdatedDate = DateTime.Now;
                    dbCompanyConfig.UpdatedBy   = component.helper.SolutionConfiguration.CurrentUserId;
                    actionStatus = _companyConfigRepository.Update(dbCompanyConfig);
                }
                return(actionStatus);
            }
            catch (Exception ex)
            {
                _logger.ErrorLog(ex, "CompanyConfig.Manage " + ex);
                return(new Entity.ActionStatus
                {
                    Success = false,
                    Message = ex.Message
                });
            }
        }
コード例 #3
0
 public IActionResult Manage([FromBody] Entity.CompanyConfig company)
 {
     return(Ok(_companyConfigService.Manage(company)));
 }