示例#1
0
        public async Task <bool> DeleteSessionType(int typeId)
        {
            try
            {
                MasterSessionType sessionType = await this.therapistContext.MasterSessionType.Where(x => x.TypeId == typeId).FirstOrDefaultAsync();

                sessionType.IsDeleted = true;
                await this.therapistContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public async Task <bool> ChangeSessionsTypesStatus(SessionsTypes type)
        {
            try
            {
                MasterSessionType types = await this.therapistContext.MasterSessionType.Where(x => x.TypeId == type.TypeId).FirstOrDefaultAsync();

                types.IsActive = type.IsActive;

                await this.therapistContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public async Task <SessionsTypes> GetSessionTypeById(int typeId)
        {
            try
            {
                SessionsTypes     sessionType       = new SessionsTypes();
                MasterSessionType masterSessionType = await this.therapistContext.MasterSessionType.Where(x => x.TypeId == typeId).FirstOrDefaultAsync();

                sessionType.TypeId    = masterSessionType.TypeId;
                sessionType.TypeName  = masterSessionType.TypeName;
                sessionType.IsActive  = masterSessionType.IsActive.Value;
                sessionType.IsDeleted = masterSessionType.IsDeleted.Value;
                return(sessionType);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public async Task <bool> AddUpdateSessionType(SessionTypeData type)
        {
            try
            {
                if (type.TypeId == 0)
                {
                    MasterSessionType sessionType = new MasterSessionType
                    {
                        TypeId       = 0,
                        TypeName     = type.TypeName,
                        IsActive     = true,
                        CreatedDate  = DateTime.UtcNow,
                        ModifiedDate = null,
                        CreatedBy    = type.CreatedBy,
                        ModifiedBy   = null,
                        IsDeleted    = false,
                    };
                    this.therapistContext.MasterSessionType.Add(sessionType);
                    await this.therapistContext.SaveChangesAsync();

                    //return sessionType.TypeId;
                }
                else
                {
                    MasterSessionType updateType = this.therapistContext.MasterSessionType.Where(x => x.TypeId == type.TypeId).FirstOrDefault();
                    updateType.TypeName     = type.TypeName;
                    updateType.ModifiedBy   = type.CreatedBy;
                    updateType.ModifiedDate = DateTime.UtcNow;

                    await this.therapistContext.SaveChangesAsync();
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }