Beispiel #1
0
        public LicenseTypesResponse CreateLicenseTypes(LicenseTypeCreateRequest request, string UserId, string TenantId)
        {
            LicenseTypesResponse responseModel     = new LicenseTypesResponse();
            LicenseTypesModel    licenseTypesModel = new LicenseTypesModel();

            licenseTypesModel.licenseTypeName = request.LicenseTypeName;

            licenseTypesModel.userId   = UserId;
            licenseTypesModel.tenantId = TenantId;

            licenseTypesModel.createdBy   = UserId;
            licenseTypesModel.createdDate = DateTime.UtcNow;

            licenseTypesModel.modifiedBy   = UserId;
            licenseTypesModel.modifiedDate = DateTime.UtcNow;

            licenseTypesModel.isActive  = true;
            licenseTypesModel.isDeleted = false;

            //// Run below line First time only
            //_cosmosDBOperationsRepository.CreateCollectionIfNotExistsAsync(licenseTypeCollectionId);

            LicenseTypesModel result = _cosmosDBOperationsRepository.AddDocumentIntoCollectionAsync(licenseTypesModel, UserId.Trim().ToString(), TenantId, licenseTypeCollectionId).Result;

            CommonFunctions.CopyProperties(result, responseModel);
            return(responseModel);
        }
        /// <summary>
        /// Save service Plan data
        /// </summary>
        /// <param name="servicePlanRequest"></param>
        /// <param name="tenantId"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task <ServicePlanModel> SaveServicePlan(ServicePlanRequest servicePlanRequest, string tenantId, string userId)
        {
            ServicePlanModel servicePlanModel = new ServicePlanModel();

            CommonFunctions.CopyProperties(servicePlanRequest, servicePlanModel);
            CommonFunctions.CopyProperties(servicePlanRequest.WorkShopDetail, servicePlanModel.WorkShopDetail);
            CommonFunctions.CopyProperties(servicePlanRequest.ServiceInterval, servicePlanModel.ServiceInterval);
            CommonFunctions.CopyProperties(servicePlanRequest.ScheduleService, servicePlanModel.ScheduleService);
            CommonFunctions.CopyProperties(servicePlanRequest.Notify, servicePlanModel.Notify);
            servicePlanModel.CreatedBy = userId;
            servicePlanModel.CreatedOn = DateTime.Now;
            servicePlanModel.IsActive  = true;
            servicePlanModel.IsDeleted = false;
            servicePlanModel.tenantId  = tenantId;
            // await _cosmosDBOperationsRepository.CreateCollectionIfNotExistsAsync(servicePlanCollectionId);
            servicePlanModel = await _cosmosDBOperationsRepository.AddDocumentIntoCollectionAsync(servicePlanModel, userId, tenantId, servicePlanCollectionId);

            return(servicePlanModel);
        }