Ejemplo n.º 1
0
        public async Task <IActionResult> AddAll(IEnumerable <Record> records)
        {
            Console.WriteLine("got here");
            foreach (var record in records)
            {
                if (await _repo.RecordExists(record.FileNumber))
                {
                    return(BadRequest("One of the file already exists"));
                }
            }
            if (await _repo.AddAll(records))
            {
                var allRecords = await _repo.GetAllRecords();

                return(Ok(allRecords));
            }
            else
            {
                return(BadRequest("Failed to add records."));
            }
        }