/// <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); }
public async Task <ActionResult> Put([FromHeader(Name = "x-tenant")] string tenantid, [FromHeader(Name = "Ocp-Apim-Subscription-Key")] string subscription, [FromHeader(Name = "x-user")] string userId, [FromBody] ServicePlanRequest servicePlanRequest) { var data = await _servicePlanService.UpdateServicePlan(tenantid, userId, servicePlanRequest); return(Ok(data)); }
public async Task <ServicePlanModel> UpdateServicePlan(string tenantId, string userId, ServicePlanRequest servicePlanRequest) { 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 = await _servicePlanRepository.UpdateServicePlan(tenantId, userId, servicePlanModel); return(servicePlanModel); }