public async Task <IActionResult> AddorUpdateTopics([FromForm] TopicRequestdata request) { JsonResponse <bool> objResult = new JsonResponse <bool>(); try { bool success = await this._superAdminService.AddorUpdateTopics(request); if (success) { objResult.Data = success; objResult.Status = StaticResource.SuccessStatusCode; objResult.Message = StaticResource.SuccessMessage; return(new OkObjectResult(objResult)); } } catch (Exception ex) { HttpContext.RiseError(ex); objResult.Data = false; objResult.Status = StaticResource.FailStatusCode; objResult.Message = StaticResource.FailMessage; } return(new OkObjectResult(objResult)); }
public async Task <bool> AddorUpdateTopics(TopicRequestdata topic) { try { MasterTopic masterTopic = new MasterTopic(); if (topic.TopicId == 0) { masterTopic.TopicId = 0; masterTopic.TopicName = topic.TopicName; masterTopic.CreatedDate = DateTime.UtcNow; masterTopic.CreatedBy = topic.CreatedBy; masterTopic.IsActive = true; masterTopic.IsDeleted = false; this.therapistContext.MasterTopic.Add(masterTopic); } else { MasterTopic master = await this.therapistContext.MasterTopic.Where(x => x.TopicId == topic.TopicId).FirstOrDefaultAsync(); master.TopicName = topic.TopicName; master.ModifiedBy = topic.CreatedBy; master.ModifiedDate = DateTime.UtcNow; } await this.therapistContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> AddorUpdateTopics(TopicRequestdata topic) { try { return(await this._superAdminRepo.AddorUpdateTopics(topic)); } catch (Exception ex) { throw ex; } }