public IHttpActionResult GetOrganizationUsingId(int orgId)
        {
            OrganizationBasicInfo currentOrganization = new OrganizationBasicInfo();

            try
            {
                using (var db = new OrganizationDAL())
                {
                    currentOrganization = db.GetFullOrganizationBasicInformation(orgId);
                }

                return(Ok(new HTTPMessageDTO
                {
                    Status = WsConstant.HttpMessageType.SUCCESS,
                    Message = "",
                    Type = "",
                    Data = currentOrganization
                }));
            }
            catch (Exception)
            {
                return(Ok(new HTTPMessageDTO
                {
                    Status = WsConstant.HttpMessageType.ERROR,
                    Message = "",
                    Type = ""
                }));
            }
        }
        public IHttpActionResult CancelCreateOrganizationRequest(int organizationId)
        {
            try
            {
                bool isSuccess;
                OrganizationBasicInfo organizationBasic;
                // Delete create request
                using (var db = new OrganizationDAL())
                {
                    //get inforamation of organziation Creator
                    organizationBasic = db.GetFullOrganizationBasicInformation(organizationId);

                    isSuccess = db.DeleteOrganization(organizationId);
                }



                //Send mail to Creator to anounce that admin reject create organization request
                if (isSuccess)
                {
                    //khai bao bien
                    var    fromAddress  = new MailAddress(WsConstant.OrganizationRegistration.AdminEmail, WsConstant.OrganizationRegistration.WsAdmin);
                    var    toAddress    = new MailAddress(organizationBasic.Creator.Email, organizationBasic.Creator.UserName);
                    string fromPassword = WsConstant.OrganizationRegistration.AdminEmailPass;
                    string subject      = WsConstant.OrganizationRegistration.EmailSubjectRejectRegistration;
                    string body         = WsConstant.OrganizationRegistration.EmailContentFirst + "Yêu cầu tạo tổ chức : '" + organizationBasic.OrganizationName + "' " + WsConstant.OrganizationRegistration.EmailContentRejectRegistration;
                    //xu li gui mail
                    var smtp = new SmtpClient
                    {
                        Host                  = "smtp.gmail.com",
                        Port                  = 587,
                        EnableSsl             = true,
                        DeliveryMethod        = SmtpDeliveryMethod.Network,
                        UseDefaultCredentials = false,
                        Timeout               = 30000,
                        Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                    };
                    using (var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = subject,
                        Body = body
                    })
                    {
                        smtp.Send(message);
                    }
                }

                return(Ok(new HTTPMessageDTO {
                    Status = WsConstant.HttpMessageType.SUCCESS, Data = isSuccess
                }));
            }
            catch (Exception)
            {
                return(Ok(new HTTPMessageDTO {
                    Status = WsConstant.HttpMessageType.ERROR
                }));
            }
        }
        public IHttpActionResult AcceptingOrganization(int organizationId)
        {
            try
            {
                OrganizationBasicInfo organizationBasic;

                using (var db = new OrganizationDAL())
                {
                    var org = db.GetOrganizationById(organizationId);
                    org.IsVerify = true;
                    org.IsActive = true;

                    db.UpdateOrganization(org);

                    organizationBasic = db.GetFullOrganizationBasicInformation(org.OrganizationId);
                }


                //send email to register user
                //khai bao bien
                var    fromAddress  = new MailAddress(WsConstant.OrganizationRegistration.AdminEmail, WsConstant.OrganizationRegistration.WsAdmin);
                var    toAddress    = new MailAddress(organizationBasic.Creator.Email, organizationBasic.Creator.UserName);
                string fromPassword = WsConstant.OrganizationRegistration.AdminEmailPass;
                string subject      = WsConstant.OrganizationRegistration.EmailSubjectAcceptRegistration;
                string body         = WsConstant.OrganizationRegistration.EmailContentFirst + "Yêu cầu tạo tổ chức : '" + organizationBasic.OrganizationName + "' " + WsConstant.OrganizationRegistration.EmailContentAcceptRegistration;
                //xu li gui mail
                var smtp = new SmtpClient
                {
                    Host                  = "smtp.gmail.com",
                    Port                  = 587,
                    EnableSsl             = true,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Timeout               = 30000,
                    Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body
                })
                {
                    smtp.Send(message);
                }



                return(Ok(new HTTPMessageDTO {
                    Status = WsConstant.HttpMessageType.SUCCESS, Data = true
                }));
            }
            catch (Exception)
            {
                return(Ok(new HTTPMessageDTO {
                    Status = WsConstant.HttpMessageType.ERROR
                }));
            }
        }