public static bool Insert(RequestLine requestLine) { if (requestLine == null) { throw new Exception("RequestLine instance must not be null"); } requestLine.Id = 0; context.RequestLine.Add(requestLine); RecalculateRequestTotal((int)requestLine.RequestId); return(context.SaveChanges() == 1); }
public static bool Delete(RequestLine requestLine) { if (requestLine == null) { throw new Exception("RequestLine instance must not be null"); } var dbrequestLine = context.RequestLine.Find(requestLine.Id); if (dbrequestLine == null) { throw new Exception("No RequestLine with that Id"); } context.RequestLine.Remove(dbrequestLine); RecalculateRequestTotal((int)requestLine.RequestId); return(context.SaveChanges() == 1); throw new NotImplementedException(); }
public static bool Update(RequestLine requestLine) { if (requestLine == null) { throw new Exception("RequestLine instance must not be null"); } var dbrequestLine = context.RequestLine.Find(requestLine.Id); if (dbrequestLine == null) { throw new Exception("No RequestLine with that Id"); } dbrequestLine.Quantity = requestLine.Quantity; return(context.SaveChanges() == 1); throw new NotImplementedException(); }