Esempio n. 1
0
        public async Task <IActionResult> UpdateAddress(InformationAddress request)
        {
            if (request.isConsent != true)
            {
                dc = new Dictionary <string, string>();
                dc.Add("refCode", "");
                dc.Add("result", "กรุณายืนยันความถูกต้องของข้อมูล");
                return(BadRequest(dc));
            }

            dt      = new DataTable();
            dc      = new Dictionary <string, string>();
            address = new List <InformationAddress>();
            if (string.IsNullOrEmpty(request.LineUserId))
            {
                dc.Add("result", "Line User ID is Empty");
                acc.REST_KeepLogRequest("Line User ID is Empty", func.JsonSerialize(request));
                return(NotFound(dc));
            }
            acc.REST_KeepLogRequest("request", func.JsonSerialize(request));
            dt = management.REST_UpdateAddress(
                request.AgreementNo,
                request.LineUserId,
                request.AddressCode,
                request.isMaillingAddress,
                request.AddressNo,
                request.Moo,
                request.Soi,
                request.RoomNo,
                request.Floor,
                request.Building,
                request.Street,
                request.District,
                request.SubDistrict,
                request.City,
                request.PostCode
                ,
                request.isConsent
                );

            if (dt.Rows.Count > 0)
            {
                dc.Add("result", dt.Rows[0]["Result"].ToString());
                acc.REST_KeepLogRequest(dt.Rows[0]["Result"].ToString(), func.JsonSerialize(request));
            }
            address = management.REST_GetAddress(request.LineUserId, request.AgreementNo);
            acc.REST_KeepLogRequest("return", func.JsonSerialize(address));
            return(Ok(address));
        }