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