public static bool Insert(RequestLine requestline)
 {
     if (requestline == null)
     {
         throw new Exception("Requestline instance can't be null");
     }
     requestline.Id = 0;
     context.RequestLine.Add(requestline);
     ReCalculateRequestTotal(requestline.RequestId); //add for other methods
     return(context.SaveChanges() == 1);             //verify 1 row affected
 }
        public static bool Delete(RequestLine requestline)
        {
            if (requestline == null)
            {
                throw new Exception("Requestline instance can't be null");
            }
            var dbrequestline = context.RequestLine.Find(requestline.Id);  //read db for requestline id, make sure it exists in db

            if (dbrequestline == null)
            {
                throw new Exception("No requestline with that id");
            }
            context.RequestLine.Remove(dbrequestline);

            ReCalculateRequestTotal(requestline.RequestId);

            return(context.SaveChanges() == 1);
        }