Пример #1
0
        public async Task <RO <Client> > CustomerNewHousehold([FromBody] HouseHoldClientData client)
        {
            var ro = new RO <Client>();

            if (ModelState.IsValid)
            {
                                #if SESAM
                VendorInterface vendor = new VendorInterface();
                ro = await vendor.AddNewClient(client);
                                #else
                var result = await VendorDL.AddNewClient(client);

                if (result != null)
                {
                    ro.ReturnCode  = 0;
                    ro.ReturnValue = result;
                }
                else
                {
                    ro.ReturnCode = -1;
                }
                                #endif
            }
            else
            {
                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
                ro.ReturnCode = -100;
                ro.Message    = $"Bad request - CustomerNewHousehold - Incorrect parameters: {message}";
            }
            return(ro);
        }