コード例 #1
0
        public async Task <ServiceResponse <bool> > SaveAsync(OrganizationConsultantItem organizationConsultantItem)
        {
            DateTime startTime = DateTime.Now;

            try
            {
                var  organizationConsultantFacade = this.Container.GetInstance <OrganizationConsultantFacade>();
                bool isDuplicate = await organizationConsultantFacade.IsDuplicateConsultantAsync(organizationConsultantItem);

                if (isDuplicate)
                {
                    base.LogMessage("SaveAsync", DateTime.Now - startTime);

                    return(new ServiceResponse <bool>
                    {
                        HasError = true,
                        Message = OrganizationFacilityConstant.DuplicateRelation,
                        Item = false
                    });
                }
                else
                {
                    base.LogMessage("SaveAsync", DateTime.Now - startTime);

                    return(new ServiceResponse <bool>
                    {
                        Item = await organizationConsultantFacade.SaveAsync(organizationConsultantItem.OrganizationConsultantId, organizationConsultantItem.OrganizationId, organizationConsultantItem.ConsultantId, organizationConsultantItem.StartDate, organizationConsultantItem.EndDate, Email),
                        Message = OrganizationConsultantConstant.ConsultantAssociatedSuccessfully
                    });
                }
            }
            catch (Exception ex)
            {
                return(new ServiceResponse <bool>
                {
                    HasError = true,
                    Message = ex.Message
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Check if user enters duplicate record asynchronously
        /// </summary>
        /// <param name="organizationConsultantItem"></param>
        /// <returns></returns>
        public Task <bool> IsDuplicateConsultantAsync(OrganizationConsultantItem organizationConsultantItem)
        {
            var organizationConsultantManager = this.container.GetInstance <OrganizationConsultantManager>();

            return(organizationConsultantManager.IsDuplicateConsultantAsync(organizationConsultantItem.OrganizationConsultantId, organizationConsultantItem.OrganizationId, organizationConsultantItem.ConsultantId));
        }