public MemberRoleTypeVo insert(MemberRoleTypeVo input) { using (var db = new MainDb()) { db.memberRoleTypes.Add(input); db.SaveChanges(); return input; } }
public MemberRoleTypeVo update(MemberRoleTypeVo input, int? memberRoleTypeId= null) { using (var db = new MainDb()) { if (memberRoleTypeId == null) memberRoleTypeId = input.memberRoleTypeId; var res = db.memberRoleTypes.FirstOrDefault(e => e.memberRoleTypeId == memberRoleTypeId); if (res == null) return null; input.created = res.created; // input.createdBy = res.createdBy; db.Entry(res).CurrentValues.SetValues(input); db.SaveChanges(); return res; } }