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> DeleteTopicById(int TypeId) { try { MasterTopic masterTopic = await this.therapistContext.MasterTopic.Where(x => x.TopicId == TypeId).FirstOrDefaultAsync(); masterTopic.IsDeleted = true; await this.therapistContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <bool> ChangeTopicStatus(TopicList request) { try { MasterTopic masterTopic = new MasterTopic(); masterTopic = await this.therapistContext.MasterTopic.Where(x => x.TopicId == request.TopicId).FirstOrDefaultAsync(); masterTopic.IsActive = request.IsActive; await this.therapistContext.SaveChangesAsync(); return(true); } catch (Exception ex) { throw ex; } }
public async Task <TopicList> GetTopicById(int TypeId) { try { TopicList topic = new TopicList(); MasterTopic master = await this.therapistContext.MasterTopic.Where(x => x.TopicId == TypeId).FirstOrDefaultAsync(); topic.TopicId = master.TopicId; topic.TopicName = master.TopicName; topic.IsActive = master.IsActive; topic.IsDeleted = master.IsDeleted; topic.Total = 0; return(topic); } catch (Exception ex) { throw ex; } }