Shares can be handled by owners
This commit is contained in:
@ -20,6 +20,15 @@ namespace StockDAL
|
||||
return connections;
|
||||
}
|
||||
|
||||
public IEnumerable<PersonStock> GetAllConnectedStocks()
|
||||
{
|
||||
using var context = new StockContext();
|
||||
var entities = (from spc in context.PersonStocks
|
||||
where spc.PersonId != 0
|
||||
select spc).ToList();
|
||||
return entities;
|
||||
}
|
||||
|
||||
public PersonStock SavePersonStockConnection(PersonStock personStock)
|
||||
{
|
||||
using var context = new StockContext();
|
||||
@ -46,5 +55,18 @@ namespace StockDAL
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void RemoveConnectedShare(PersonStock personStock)
|
||||
{
|
||||
using var context = new StockContext();
|
||||
var entity = (from ps in context.PersonStocks
|
||||
where ps.StockId == personStock.StockId
|
||||
select ps).FirstOrDefault();
|
||||
if (entity != null)
|
||||
{
|
||||
context.PersonStocks.Remove(entity);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user