public int UpdateGroupElementCode(GroupElementCode groupElementCode) { string sql = @"UPDATE [GroupElementCode] SET [ElementCode] = @ElementCode, [ElementName] = @ElementName, [GroupType] = @GroupType, [IsActive] = @IsActive, [LastUpdatedById] = @LastUpdatedById, [LastUpdatedDate] = @LastUpdatedDate WHERE [Id] = @Id"; var id = db.Connection.Query <int>(sql, groupElementCode).FirstOrDefault(); return(id); }
public int InsertGroupElementCode(GroupElementCode groupElementCode) { string sql = @"INSERT INTO [GroupElementCode] ([ElementCode], [ElementName], [GroupType], [IsActive], [CreatedById], [CreatedDate], [LastUpdatedById], [LastUpdatedDate]) VALUES (@ElementCode, @ElementName, @GroupType, @IsActive, @CreatedById, @CreatedDate, @LastUpdatedById, @LastUpdatedDate); SELECT CAST(SCOPE_IDENTITY() as int)"; var id = db.Connection.Query <int>(sql, groupElementCode).FirstOrDefault(); return(id); }