public static void SaveClientTax(ClientsModel model, int clientId) { DataContext db = new DataContext(); TblTax tbl = new TblTax(); tbl.UpdatedBy = model.UpdatedById; tbl.FilePathNew = model.FilePathNew; tbl.FilePathOld = model.FilePathOld; tbl.ClientId = clientId; tbl.UserId = model.UserId; tbl.YearId = model.YearId; tbl.LastChangesInfo = model.LastChanges; db.TblTaxes.InsertOnSubmit(tbl); db.SubmitChanges(); db.Dispose(); }
public static void UpdateClientTax(ClientsModel model, int clientId) { DataContext db = new DataContext(); TblTax result = (from a in db.TblTaxes join c in db.TblClients on a.ClientId equals c.Id join u in db.TblUsers on a.UserId equals u.Id join y in db.TblYears on a.YearId equals y.Id where a.ClientId == clientId && y.Year == model.Year select a).SingleOrDefault(); result.LastChangesInfo = model.LastChanges; result.FilePathNew = model.FilePathNew; result.FilePathOld = model.FilePathOld; result.UpdatedBy = model.UpdatedById; result.UserId = model.UserId; InsertForUniqueId(); db.SubmitChanges(); }