Exemplo n.º 1
0
        public IActionResult Post([FromBody] ReqTinDang value)
        {
            CustomResult cusRes = new CustomResult();

            try {
                if (string.IsNullOrEmpty(value.Data.Ma) || string.IsNullOrEmpty(value.Data.DiaChi) || string.IsNullOrEmpty(value.Data.TenLoai))
                {
                    cusRes.SetException("Dữ liệu không hợp lệ. Vui lòng kiểm tra lại thông tin dự án");
                }
                else
                {
                    string path = CommonMethods.getPathImages(value.Data.Ma);
                    if (path == string.Empty)
                    {
                        cusRes.SetException("Dự án không tồn tại thư mục ảnh. Vui lòng tải ảnh lên để thực hiện tiếp.");
                    }
                    else
                    {
                        cusRes.StrResult = new ProcessDangTin().dangTin(value);
                        cusRes.Message   = Messages.SCS_001;
                        cusRes.IntResult = 1;
                    }
                }
            } catch (Exception ex) {
                cusRes.SetException(ex.Message);
            }
            return(Ok(cusRes));
        }
Exemplo n.º 2
0
        public string dangTin(ReqTinDang reqTinDang)
        {
            var indexaccount = DataMasterHelper.getAccounts().IndexOf(reqTinDang.Data.TenDangNhap.ToLower());

            if (indexaccount < 0)
            {
                if (!Variables.SELENIUM_ALLOW_ANY_ACCOUNT)
                {
                    string er = $"Tài khoản {reqTinDang.Data.TenDangNhap} không thể đăng tin do không nằm trong danh sách tài khoản cho phép";
                    CommonMethods.notifycation_tele(er);
                    throw new Exception(er);
                }
                else
                {
                    CommonMethods.notifycation_tele($"Tài khoản {reqTinDang.Data.TenDangNhap} không nằm trong danh sách cho phép đang thực hiện đăng tin");
                }
            }
            var error = "Không tìm thấy nguồn phù hợp";

            if (reqTinDang.Sources.ToString().IndexOf(Variables.NguonTinDang.BatDongSan.ToString()) >= 0)
            {
                error = null;
                return(new ProcessDangTin_BDS().dangTin(reqTinDang.Data));
            }
            if (!String.IsNullOrEmpty(error))
            {
                throw new Exception(error);
            }
            return("");
        }