public bool CreateSystemPlan(SystemPlanCreate plan) { var entity = new SystemPlan() { Id = _userId, FitId = plan.FitId, DietId = plan.DietId, PlanGoal = plan.PlanGoal, StartingWeight = plan.StartingWeight, CreatedUtc = DateTimeOffset.Now, ModifiedUtc = DateTime.Now }; using (var ctx = new ApplicationDbContext()) { ctx.SystemPlan.Add(entity); return(ctx.SaveChanges() == 1); } }
public bool CreateSystemPlan(SystemPlanCreate plan) { var entity = new SystemPlan() { SysId = plan.SysId, UserId = _systemId, FitnessId = _systemId, DietId = _systemId, //Name = plan.Name, StartingWeight = plan.StartingWeight, PlanGoal = plan.PlanGoal, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.SystemPlan.Add(entity); return(ctx.SaveChanges() > 0); } }