public static int CreateForm(int formId, int productionUnitId, int periodNumber, DateTime formDate) { int financialFormId = 0; FinancialSDZEEForm entity = new FinancialSDZEEForm(); using (var db = new Models.SmizeeContext()) { entity.FormID = formId; entity.StateID = 1; entity.PeriodNumber = periodNumber; entity.FormDate = formDate; db.FinancialSDZEEForms.Add(entity); db.SaveChanges(); financialFormId = entity.FinancialSDZEEFormID; } return(financialFormId); }