var quantityDetails =
(Quantity) (from q in _db.Quantities
join o in _db.OrderDetails on q.OrderDetailId equals o.OrderDetailId
join d in _db.Doctors on o.DoctorsId equals d.DoctorsId
where q.Quantity1 > 0
select q).Single();
quantityDetails.Quantity1 = quantityDetails.Quantity1 - 1;
_db.SaveChanges();
had to change because had to make sure connected to only the user login and change form single to firstordefault because
getting error code sequence contains more than one element
var quantityDetails = (from u in _db.aspnet_Users
where u.UserName == HttpContext.Current.User.Identity.Name
join d in _db.Doctors on u.UserId equals d.UserId
join o in _db.OrderDetails on d.DoctorsId equals o.DoctorsId
join q in _db.Quantities on o.OrderDetailId equals q.OrderDetailId
where q.Quantity1 > 0
select q).FirstOrDefault();
if (quantityDetails != null) quantityDetails.Quantity1 = quantityDetails.Quantity1 - 1;
_db.SaveChanges();