コード例 #1
0
        public async Task <ActionResult <CharityModel> > Update([FromBody] CharityModel charityModel)
        {
            var validationResults = await charityModel.Validate(_db);

            if (!validationResults.IsValid)
            {
                return(BadRequest(validationResults.ToString()));
            }

            await charityModel.CreateOrUpdate(_db, _queue, _requestContext);

            return(Ok(charityModel));
        }
コード例 #2
0
        public async Task <ActionResult <DonorModel> > CreateOrUpdate(long donorId, [FromBody] CharityModel charityModel)
        {
            charityModel.DonorId = donorId;
            var validationResults = await charityModel.Validate(_db);

            if (!validationResults.IsValid)
            {
                return(BadRequest(validationResults.ToString()));
            }

            await charityModel.CreateOrUpdate(_db);

            return(Ok(charityModel));
        }