public async Task <bool> ChangeActiveStatus(CompanyMembers members)
 {
     try
     {
         return(await this._companyRepo.ChangeActiveStatus(members));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        public async Task <bool> ChangeActiveStatus(CompanyMembers members)
        {
            try
            {
                Users users = await this.therapistContext.Users.Where(x => x.UserId == members.UserId).FirstOrDefaultAsync();

                if (members.Block ?? true)
                {
                    users.IsBlocked = members.IsBlocked;
                }
                else
                {
                    users.IsActive = members.IsActive;
                }
                await this.therapistContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> ChangeActiveStatus([FromBody] CompanyMembers member)
        {
            JsonResponse <bool> objResult = new JsonResponse <bool>();

            try
            {
                bool success = await this._companyService.ChangeActiveStatus(member);

                if (success)
                {
                    objResult.Data    = success;
                    objResult.Status  = StaticResource.SuccessStatusCode;
                    objResult.Message = StaticResource.SuccessMessage;
                }
            }
            catch (Exception ex)
            {
                HttpContext.RiseError(ex);
                objResult.Data    = false;
                objResult.Status  = StaticResource.FailStatusCode;
                objResult.Message = StaticResource.FailMessage;
            }
            return(new OkObjectResult(objResult));
        }