public class Bar
{
[Key]
public int BarID { get; set; }
public int Quantity { get; set; }
public decimal UnitTotal { get; set; }
public decimal? DailyTotal { get; set; }
public int PricelistID { get; set; }
public virtual Pricelist Pricelist { get; set; }
}
//in the BarController Create method
bar.DailyTotal = db.Bars.Sum(x => x.UnitTotal);
Asked
Active
Viewed 934 times
-1

har07
- 88,338
- 12
- 84
- 137

user2985240
- 95
- 2
- 8
-
What is the question here ? What do you want ? What do you get ? – thomasb Jun 02 '15 at 10:05
-
make unitTotal nullable: ``decimal? UnitTotal`` – Ehsan Sajjad Jun 02 '15 at 12:06
1 Answers
0
It would suggest that you have a null in the UnitTotal
column in your DB. You could either eliminate the null or change the type to be decimal?

Stu
- 2,426
- 2
- 26
- 42