Edit stocklist. add stocks,
This commit is contained in:
@ -15,7 +15,35 @@ namespace StockDAL
|
||||
{
|
||||
using (var context = new StockContext())
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
if (stockMember.Id > 0)
|
||||
{
|
||||
var entity = (from stk in context.Stocks
|
||||
where stk.Id == stockMember.Id
|
||||
select stk).FirstOrDefault();
|
||||
if (entity != null)
|
||||
{
|
||||
entity.StockId = stockMember.StockId;
|
||||
entity.StockExtId = stockMember.StockExtId;
|
||||
entity.ActValue = stockMember.ActValue;
|
||||
entity.ActAmount= stockMember.ActAmount;
|
||||
entity.SoldDate = stockMember.SoldDate;
|
||||
entity.ActDate = stockMember.ActDate;
|
||||
entity.SoldStockPrice = stockMember.SoldStockPrice;
|
||||
entity.SoldValue = stockMember.SoldValue;
|
||||
entity.PostAmount = stockMember.PostAmount;
|
||||
entity.Comment = stockMember.Comment;
|
||||
entity.BuyDate = stockMember.BuyDate;
|
||||
entity.BuyValue = stockMember.BuyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var sm = context.Stocks.Add(stockMember);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
@ -111,7 +139,7 @@ namespace StockDAL
|
||||
join stk in context.Stocks on prs.StockId equals stk.Id
|
||||
join grp in context.StockGroups on stk.StockId equals grp.StockName
|
||||
where prs.PersonId == persId
|
||||
orderby grp.GroupName, grp.StockName
|
||||
orderby grp.GroupName, grp.StockName
|
||||
select new StockGrpPers
|
||||
{
|
||||
PersId = persId,
|
||||
|
||||
Reference in New Issue
Block a user