コード例 #1
0
        public async Task <BaseResponseWrapper> UploadMatchDays([FromForm] FileUpload objFile)
        {
            try
            {
                var result = GetStringFromFile(objFile);

                var data = JsonSerializer.Deserialize <List <Match> >(result.ToString(), serializerOptions);

                await fantasySoccerService.OverwriteMatchesAsync(data);

                return(new ResponseWrapper <string>
                {
                    StatusCode = Models.Responses.StatusCode.OK,
                    Message = "Matches updated."
                });
            }
            catch
            {
                return(new ResponseWrapper <string>
                {
                    StatusCode = Models.Responses.StatusCode.BadRequest,
                    Message = "Couldn't update matches. \nTry again later"
                });
            }
        }