...
This commit is contained in:
71
Back/Controllers/stuffController.cs
Normal file
71
Back/Controllers/stuffController.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class stuffController : ControllerBase
|
||||
{
|
||||
private readonly Servstuff _Servstuff;
|
||||
public stuffController(Servstuff Servstuff)
|
||||
{
|
||||
_Servstuff = Servstuff;
|
||||
}
|
||||
[HttpGet("Getstuff/{value}")]
|
||||
public async Task<ActionResult> Getstuff(string value)
|
||||
{
|
||||
return Ok(await _Servstuff.Getstuff(value));
|
||||
}
|
||||
//[HttpPost("InitalInTb")]
|
||||
//public async Task<ActionResult> InitalInTb()
|
||||
//{
|
||||
// int countererror = 0;
|
||||
// List<stuff> stuffDtos = new List<stuff>();
|
||||
// //------
|
||||
// using (StreamReader sr = new StreamReader("C://AllserviceStuff.CSV"))
|
||||
// {
|
||||
// string line = "";
|
||||
// while ((line = sr.ReadLine()) != null)
|
||||
// {
|
||||
// string[] cells = line.Split(new char[] { '\r', '\n' }, StringSplitOptions.None);
|
||||
// if (cells.Length > 0)
|
||||
// {
|
||||
// var item = cells[0].Split(',');
|
||||
// if (item[0] == "ID") continue;
|
||||
// try
|
||||
// {
|
||||
// stuffDtos.Add(new stuff
|
||||
// {
|
||||
// CID = item[0],
|
||||
// sType = item[1],
|
||||
// sDate = item[2],
|
||||
// RunDate = item[3],
|
||||
// ExpirationDate = item[4],
|
||||
// SpecialOrGeneral = item[5],
|
||||
// TaxableOrFree = item[6],
|
||||
// Vat = item[7],
|
||||
// VatCustomPurposes = item[8],
|
||||
// DescriptionOfID = item[9]
|
||||
// });
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// countererror++;
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Ok(await _Servstuff.AddRange(stuffDtos));
|
||||
//}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user