public void CreateProc(inOilManger input) { try { var oilID = ioilDAO.Get_Oilname().FirstOrDefault(x => x.Oilname == input.OilName); var carID = ioilDAO.Get_Num().FirstOrDefault(x => x.CarNumber == input.CarNumber); Guid g = Guid.NewGuid(); DateTime saveUtcNow = DateTime.UtcNow; OilManger entity = new OilManger() { Id = g, Date = DateTime.UtcNow, Oilname = input.OilName, CarNumber = input.CarNumber, Card = input.Card, Mileage = input.Mileage, OilMoney = input.OilMoney, OilQuantity = input.OilQuantity, OilId = oilID.OilId, CarId = carID.DeliveryCarId }; ioilDAO.Create_Value(entity); } catch (Exception e) { throw new Exception(); } }
public void Create_Value(OilManger test) { try { _context.OilManger.Add(test); _context.SaveChanges(); } catch (Exception e) { throw new Exception(); } }
public void Update_Value(OilManger test) { try { var oriUser = _context.OilManger.Single(x => x.Id == test.Id); _context.Entry(oriUser).CurrentValues.SetValues(test); _context.SaveChanges(); } catch (Exception e) { throw new Exception(); } }